Modules
This section provides deep-dive documentation for each backend module in src/. Each module has a well-defined responsibility and communicates with other modules via Redis pub/sub or direct function calls within the modular monolith.
In This Section
- Core — Pydantic domain models, abstract interfaces, config loading, async database client, and Redis connection management
- Data Ingestion — Multi-source data pipeline: IBKR/AlphaVantage market feeds, OHLCV bars, SEC filings, fundamental data, and alternative data (insider trades, short interest)
- Strategy Engine — Strategy registration, backtesting, walk-forward validation, composite ranking, regime detection, and Monte Carlo simulation
- ML Pipeline — Feature store (50+ point-in-time features), XGBoost training, walk-forward validation, confidence calibration, drift monitoring, and model registry
- Execution Engine — Half-Kelly position sizing, smart order routing (market/limit/TWAP), broker adapter integration, and execution quality tracking
- Risk Management — PDT guard, pre-trade checks, circuit breakers, kill switch, autonomy validator, and LLM guardrails
- Scheduling — APScheduler cron jobs for daily bars, weekly fundamentals, biweekly alt data, weekly retraining, sentiment, and daily briefing; idempotent via Redis
- API Layer — FastAPI REST routes, WebSocket broadcasting via Redis pub/sub, and dependency injection patterns
- Agents — Claude-powered advisory agents (Analyst, Advisor, Briefing), cost tracking, rate limiting, and response caching
- Monitoring — Prometheus metrics, Grafana dashboards, Slack/Telegram alerts, and structured logging via structlog