trading/docker-compose.yml
Viktor Barzin d36ae40df1
feat: productionize local service — fix signal pipeline, lower thresholds, add company-name ticker extraction
- Point Ollama to local instance via host.docker.internal, use gemma3 model
- Remove Docker Ollama service (using host's Ollama instead)
- Add company-name-to-ticker mapping (Apple→AAPL, Tesla→TSLA, etc.) for RSS articles
- Lower signal thresholds for faster feedback with paper trading:
  - FinBERT confidence: 0.6→0.4, signal strength: 0.3→0.15
  - News strategy: article_count 2→1, confidence 0.5→0.3, score ±0.3→±0.15
- Fix market data BarSet access bug (BarSet.__contains__ returns False incorrectly)
- Fix market data SIP feed error by switching to IEX feed for free Alpaca accounts
- Fix nginx proxy routing for /api/auth/* to api-gateway /auth/*
- Add seed_sample_data script
- Update tests for new thresholds and alpaca mock modules
2026-02-22 22:17:26 +00:00

180 lines
4.3 KiB
YAML

services:
# ---------------------------------------------------------------------------
# Infrastructure
# ---------------------------------------------------------------------------
postgres:
image: timescale/timescaledb:latest-pg16
environment:
POSTGRES_USER: trading
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-trading}
POSTGRES_DB: trading
ports:
- "127.0.0.1:5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U trading"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
ports:
- "127.0.0.1:6379:6379"
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# Database migrations — runs once before application services start
# ---------------------------------------------------------------------------
migrations:
build:
context: .
dockerfile: docker/Dockerfile.service
args:
EXTRAS: "dev"
SERVICE_MODULE: "api_gateway"
depends_on:
postgres:
condition: service_healthy
env_file: .env
command: python -m alembic upgrade head
restart: "no"
# ---------------------------------------------------------------------------
# Application services
# ---------------------------------------------------------------------------
news-fetcher:
build:
context: .
dockerfile: docker/Dockerfile.service
args:
EXTRAS: "news"
SERVICE_MODULE: "news_fetcher"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrations:
condition: service_completed_successfully
env_file: .env
restart: unless-stopped
sentiment-analyzer:
build:
context: .
dockerfile: docker/Dockerfile.service
args:
EXTRAS: "sentiment"
SERVICE_MODULE: "sentiment_analyzer"
depends_on:
redis:
condition: service_healthy
migrations:
condition: service_completed_successfully
env_file: .env
restart: unless-stopped
signal-generator:
build:
context: .
dockerfile: docker/Dockerfile.service
args:
EXTRAS: "trading"
SERVICE_MODULE: "signal_generator"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrations:
condition: service_completed_successfully
env_file: .env
restart: unless-stopped
trade-executor:
build:
context: .
dockerfile: docker/Dockerfile.service
args:
EXTRAS: "trading"
SERVICE_MODULE: "trade_executor"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrations:
condition: service_completed_successfully
env_file: .env
restart: unless-stopped
learning-engine:
build:
context: .
dockerfile: docker/Dockerfile.service
args:
EXTRAS: "trading"
SERVICE_MODULE: "learning_engine"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrations:
condition: service_completed_successfully
env_file: .env
restart: unless-stopped
market-data:
build:
context: .
dockerfile: docker/Dockerfile.service
args:
EXTRAS: "trading"
SERVICE_MODULE: "market_data"
depends_on:
redis:
condition: service_healthy
env_file: .env
restart: unless-stopped
api-gateway:
build:
context: .
dockerfile: docker/Dockerfile.service
args:
EXTRAS: "api,trading,backtester"
SERVICE_MODULE: "api_gateway"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrations:
condition: service_completed_successfully
ports:
- "8000:8000"
env_file: .env
restart: unless-stopped
dashboard:
build:
context: .
dockerfile: docker/Dockerfile.dashboard
depends_on:
- api-gateway
ports:
- "3000:80"
restart: unless-stopped
volumes:
pgdata:
redisdata: