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:
root
2026-05-12 13:38:34 +00:00
parent 76d1a4a32d
commit 19695e4730
10 changed files with 111 additions and 33 deletions
+2 -1
View File
@@ -87,7 +87,8 @@ def _seed_dvol_history(ctx, *, when: datetime, spot: Decimal, dvol: Decimal):
try:
with transaction(conn):
ctx.repository.record_dvol_snapshot(
conn, DvolSnapshot(timestamp=when, dvol=dvol, eth_spot=spot)
conn,
DvolSnapshot(timestamp=when, asset="ETH", dvol=dvol, spot=spot),
)
finally:
conn.close()