trading/services/api_gateway/config.py
Viktor Barzin e2a3bd456d
feat: real data pipeline — market data, DB persistence, portfolio sync, signal-trade linkage
Wire the trading bot to real Alpaca market data and persist pipeline
state to the database so the dashboard displays live information.

- Add market-data service fetching OHLCV bars from Alpaca, publishing
  to market:bars Redis Stream; signal generator consumes bars and
  injects current_price into signals for position sizing
- Sentiment analyzer now persists Article + ArticleSentiment rows to
  DB after scoring, with duplicate and error handling
- API gateway runs a background portfolio sync task that snapshots
  Alpaca account state into PortfolioSnapshot/Position DB tables
  during market hours
- TradeSignal carries a signal_id UUID; signal generator and trade
  executor both persist their records to DB with cross-references
- 303 unit tests pass (57 new tests added)
2026-02-22 19:52:45 +00:00

31 lines
963 B
Python

"""API Gateway configuration — extends shared BaseConfig with JWT, CORS, and WebAuthn settings."""
from shared.config import BaseConfig
class ApiGatewayConfig(BaseConfig):
"""Configuration for the API Gateway service.
All settings can be overridden via environment variables
prefixed with ``TRADING_``.
"""
# JWT settings — TRADING_JWT_SECRET_KEY must be set in environment
jwt_secret_key: str
jwt_algorithm: str = "HS256"
access_token_expire_minutes: int = 15
refresh_token_expire_days: int = 7
# Alpaca brokerage credentials (for portfolio sync)
alpaca_api_key: str = ""
alpaca_secret_key: str = ""
paper_trading: bool = True
snapshot_interval_seconds: int = 60
# CORS settings
cors_origins: list[str] = ["http://localhost:5173"]
# WebAuthn (passkey) relying party settings
rp_id: str = "localhost"
rp_name: str = "Trading Bot"
rp_origin: str = "http://localhost:5173"