feat(state): dvol_history multi-asset (ETH+BTC) + backfill ETH legacy rows
Migration 0006 promuove dvol_history da PK=(timestamp) mono-ETH a PK=(timestamp, asset), rinomina eth_spot -> spot, e backfilla con asset='ETH' le righe storiche. market_snapshot_cycle ora scrive sia per ETH che per BTC; monitor_cycle resta ETH-only via WHERE asset='ETH' nella lookup di return_4h. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -242,7 +242,7 @@ async def run_monitor_cycle(ctx: RuntimeContext, *, now):
|
||||
dvol = await deribit.latest_dvol(currency="ETH", now=now)
|
||||
return_4h = await _fetch_return_4h(ctx, now=now) # usa dvol_history o
|
||||
# fallback get_historical
|
||||
repo.record_dvol_snapshot(DvolSnapshot(timestamp=now, dvol=dvol, eth_spot=spot))
|
||||
repo.record_dvol_snapshot(DvolSnapshot(timestamp=now, asset="ETH", dvol=dvol, spot=spot))
|
||||
|
||||
for record in repo.list_positions(status="open"):
|
||||
snapshot = await _build_position_snapshot(...)
|
||||
|
||||
Reference in New Issue
Block a user