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:
@@ -339,12 +339,13 @@ class Repository:
|
||||
self, conn: sqlite3.Connection, snapshot: DvolSnapshot
|
||||
) -> None:
|
||||
conn.execute(
|
||||
"INSERT OR REPLACE INTO dvol_history(timestamp, dvol, eth_spot) "
|
||||
"VALUES (?,?,?)",
|
||||
"INSERT OR REPLACE INTO dvol_history(timestamp, asset, dvol, spot) "
|
||||
"VALUES (?,?,?,?)",
|
||||
(
|
||||
_enc_dt(snapshot.timestamp),
|
||||
snapshot.asset,
|
||||
_enc_dec(snapshot.dvol),
|
||||
_enc_dec(snapshot.eth_spot),
|
||||
_enc_dec(snapshot.spot),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user