fix: resolve 8 critical issues from code review

C1: Fix BacktestDataLoader constructor args (was passing wrong kwargs)
C2: Fix BacktestResult attribute names (max_drawdown_pct, avg_hold_duration)
C3: Remove insecure JWT secret default (now required via env var)
C4: Fix .env.example to use TRADING_ prefix for all config vars
C5: Add missing fields to portfolio endpoint (daily_pnl_pct, total_pnl, trading_active)
C6: Add missing /portfolio/metrics endpoint
C7: Add 'value' field to equity curve response for frontend compatibility
C8: Add 6M/ALL periods and case-insensitive period enum parsing
Also: make app creation lazy to avoid config validation at import time
This commit is contained in:
Viktor Barzin 2026-02-22 17:48:40 +00:00
parent 870961f3e9
commit 2a56727267
No known key found for this signature in database
GPG key ID: 0EB088298288D958
5 changed files with 103 additions and 27 deletions

View file

@ -99,5 +99,6 @@ def create_app(config: ApiGatewayConfig | None = None) -> FastAPI:
return app
# Convenience: allow ``uvicorn services.api_gateway.main:app``
app = create_app()
def get_app() -> FastAPI:
"""Lazy app factory for uvicorn: ``uvicorn services.api_gateway.main:get_app --factory``."""
return create_app()