Status: ✅ IMPLEMENTED —
src/polyalpha/history/(candle/store/recorder/config + registry/view),Bot/BotHub/Client/Globalswiring,docs/history.md, examples + tests. Two features, two docs. Read in order.
-
01 — Warmup strat (
plans/01-warmup-strat.md): run a strat that collects 1 s Chainlink, compresses to candles, and blocks untilNcloses (e.g.10×1m,50×1d) before trading. SingleBot, owns its recorder + SQLite, honest warmup,block="wait"|"skip"gate,ctx.chainlink_history.ema("1d",50). -
02 — Shared API / N strats (
plans/02-shared-api.md): one recorder, one WS, one DB → NBotHubstrats +Client/notebook readers. SingletonRegistry,Globals.chainlink_history,ChainlinkHistoryViewper strat, WAL-concurrent SQLite, union warmup.
Both share same core:
- Package:
src/polyalpha/history/—candle.py/store.py/recorder.py/config.py(01) +registry.py/view.py(02) - Data:
candles(asset,tf,start_ts, o/h/l/c, count)in~/.polyalpha/chainlink.db(WAL), built by flooringtstoTIMEFRAME_SECONDS(src/polyalpha/core/constants.py:22) on each Chainlink tick fromwss://ws-live-data.polymarket.com(src/polyalpha/analysis/streaming.py:82). Indicators viaIndicatorCalculator(src/polyalpha/analysis/indicators.py:43) /_native_ta(src/polyalpha/analysis/_native_ta.py). - Integration:
Client/Bot(src/polyalpha/bot.py:503) /BotHub(src/polyalpha/bot_hub/hub.py:1341) acceptchainlink_history=ChainlinkHistoryConfig|ChainlinkRecorder; exposectx.chainlink_historyalongside existingctx.chainlink(src/polyalpha/bot.py:336) /ctx.cl(src/polyalpha/bot.py:369); persist across restarts.
Start with 01 MVP (single strat warmup), then 02 (shared layer) is additive.