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:
+14
-5
@@ -137,16 +137,25 @@ CREATE INDEX idx_decisions_proposal ON decisions(proposal_id);
|
||||
|
||||
### `dvol_history`
|
||||
|
||||
Snapshot DVOL + ETH spot ad ogni evaluation. Utile per il calcolo di
|
||||
`return_4h` durante il monitor (vedi `runtime/monitor_cycle.py
|
||||
_fetch_return_4h`) e per analisi post-mortem.
|
||||
Snapshot DVOL + spot per asset ad ogni evaluation. Utile per il
|
||||
calcolo di `return_4h` durante il monitor (vedi
|
||||
`runtime/monitor_cycle.py _fetch_return_4h`, che filtra `asset='ETH'`)
|
||||
e per analisi post-mortem comparate fra ETH e BTC. Lo schema è
|
||||
multi-asset dal migration `0006_dvol_history_multi_asset.sql`; le
|
||||
righe storiche pre-migration sono state backfillate con
|
||||
`asset='ETH'`.
|
||||
|
||||
```sql
|
||||
CREATE TABLE dvol_history (
|
||||
timestamp TEXT PRIMARY KEY,
|
||||
timestamp TEXT NOT NULL,
|
||||
asset TEXT NOT NULL, -- "ETH", "BTC"
|
||||
dvol NUMERIC NOT NULL,
|
||||
eth_spot NUMERIC NOT NULL
|
||||
spot NUMERIC NOT NULL,
|
||||
PRIMARY KEY (timestamp, asset)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_dvol_history_asset_ts
|
||||
ON dvol_history(asset, timestamp DESC);
|
||||
```
|
||||
|
||||
### `manual_actions`
|
||||
|
||||
Reference in New Issue
Block a user