Raxx · internal docs

internal · gated

Historical bars seed

Pre-warms the historical_bars table so the first backtest is fast.

Run once after FLAG_HISTORICAL_BARS_ON_DEMAND is enabled on production.

When to use

Invocation

heroku run --app raxx-api-prod \
    python scripts/seed_historical_bars.py \
    --symbols SPY,QQQ,IWM,AAPL,MSFT \
    --lookback-days 730

Common variants:

# Dry run — prints what would be fetched, no DB writes
heroku run --app raxx-api-prod \
    python scripts/seed_historical_bars.py \
    --symbols SPY,QQQ --lookback-days 365 --dry-run

# 5-year seed for the full default symbol set
heroku run --app raxx-api-prod \
    python scripts/seed_historical_bars.py \
    --symbols SPY,QQQ,IWM,AAPL,MSFT,TSLA,NVDA \
    --lookback-days 1825

Expected output

Seed parameters:
  symbols:       SPY, QQQ, IWM, AAPL, MSFT
  date range:    2024-05-28 .. 2026-05-28
  lookback_days: 730
  mode:          paper
  dry_run:       False

  Seeding SPY (2024-05-28 .. 2026-05-28) ... 502 bars cached.
  Seeding QQQ (2024-05-28 .. 2026-05-28) ... 502 bars cached.
  ...

Done. 2510 real bars ensured in historical_bars table.

Already-cached bars are skipped (gap detection). Re-running is idempotent.

Notes