fix: market data rate limiting and backtest price lookup

- Increase market_api polling cadence from 60s to 900s (15 min).
  The prev-day bar endpoint returns the same data all day, so polling
  every minute wastes API quota. 50 tickers at 15-min cadence = ~3.3
  req/min, well within the 5/min rate limit.
- Reduce market_api rate limit from 30/min to 5/min to match.
- Fix backtest replay to query market_snapshots with data->>'c' for
  close prices instead of nonexistent market_data.close_price column.
- Enrich backtest recommendations with prices from market_snapshots
  and sectors from companies table.
This commit is contained in:
Celes Renata
2026-04-15 22:19:44 +00:00
parent 69eb366bf9
commit ea6c2b3f54
2 changed files with 36 additions and 2 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ def _ensure_dict(val: Any) -> Optional[dict]:
# Default polling cadences by source class (seconds).
# Individual sources can override via config.polling_interval_seconds.
DEFAULT_CADENCES: dict[str, int] = {
"market_api": 60,
"market_api": 900,
"news_api": 300,
"filings_api": 3600,
"web_scrape": 1800,
@@ -55,7 +55,7 @@ DEFAULT_CADENCES: dict[str, int] = {
# Default rate limits per source type (requests per minute)
DEFAULT_RATE_LIMITS: dict[str, int] = {
"market_api": 30,
"market_api": 5,
"news_api": 20,
"filings_api": 10,
"web_scrape": 10,