Data aggregation and distribution service: - Market data collection - OHLCV aggregation - Real-time data feeds - Data API endpoints Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
94 lines
2.4 KiB
YAML
94 lines
2.4 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
data-service:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: trading-data-service
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${DATA_SERVICE_PORT:-8001}:8001"
|
|
environment:
|
|
# Database
|
|
- DB_HOST=${DB_HOST:-postgres}
|
|
- DB_PORT=${DB_PORT:-5432}
|
|
- DB_NAME=${DB_NAME:-trading_trading}
|
|
- DB_USER=${DB_USER:-trading_user}
|
|
- DB_PASSWORD=${DB_PASSWORD:-trading_dev_2025}
|
|
|
|
# Data Providers
|
|
- POLYGON_API_KEY=${POLYGON_API_KEY:-}
|
|
- POLYGON_TIER=${POLYGON_TIER:-basic}
|
|
- BINANCE_API_KEY=${BINANCE_API_KEY:-}
|
|
- BINANCE_API_SECRET=${BINANCE_API_SECRET:-}
|
|
- BINANCE_TESTNET=${BINANCE_TESTNET:-false}
|
|
|
|
# MetaAPI (MT4/MT5)
|
|
- METAAPI_TOKEN=${METAAPI_TOKEN:-}
|
|
- METAAPI_ACCOUNT_ID=${METAAPI_ACCOUNT_ID:-}
|
|
|
|
# Service Settings
|
|
- SYNC_INTERVAL_MINUTES=${SYNC_INTERVAL_MINUTES:-5}
|
|
- BACKFILL_DAYS=${BACKFILL_DAYS:-30}
|
|
- LOG_LEVEL=${LOG_LEVEL:-INFO}
|
|
|
|
volumes:
|
|
- ./src:/app/src:ro
|
|
- ./logs:/app/logs
|
|
networks:
|
|
- trading-network
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_started
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
postgres:
|
|
image: timescale/timescaledb:latest-pg15
|
|
container_name: trading-timescaledb
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${POSTGRES_PORT:-5432}:5432"
|
|
environment:
|
|
- POSTGRES_USER=${DB_USER:-trading_user}
|
|
- POSTGRES_PASSWORD=${DB_PASSWORD:-trading_dev_2025}
|
|
- POSTGRES_DB=${DB_NAME:-trading_trading}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./database/init:/docker-entrypoint-initdb.d:ro
|
|
networks:
|
|
- trading-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-trading_user} -d ${DB_NAME:-trading_trading}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: trading-redis
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- redis_data:/data
|
|
networks:
|
|
- trading-network
|
|
|
|
networks:
|
|
trading-network:
|
|
driver: bridge
|
|
name: trading-network
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|