libro di bordo: DB dei trade allineato col tempo + giornale giornaliero

I trade erano salvati, ma non allineati col tempo: book_execute.py scriveva
ts_utc = pd.Timestamp(r['last_data']), cioe' la data della BARRA DI SEGNALE.
19 righe su 19 a 00:00:00, e un trade (ETH 0.04 @ 1869.74) registrato SEI
GIORNI prima di essere eseguito — fill vero 2026-07-14T14:00, scritto 08/07.
L'ora vera esisteva solo in logs/cron_book.log, che e' gitignored, fuori dal
backup e ruotabile: la cronologia reale del libro live viveva in un file che
una rotazione avrebbe cancellato senza che nessuno se ne accorgesse.

- src/live/tradesdb.py: parser del cron log (ora vera + contesto del segnale),
  FIFO con fee pro-quota, riconciliazione a tre fonti, sqlite in data/live/
  (dentro il perimetro del backup). Le tre fonti si INCROCIANO e non si
  sovrascrivono: reconcile() riporta le divergenze e non ripara niente da solo.
  Il venue e' autorevole ma TRONCA (1 trade su BTC, 0 su ETH): dichiarato.
- scripts/live/trades_db.py: --sync (idempotente, in cron_book ogni ora),
  --report, --reconcile.
- src/live/journal.py + scripts/live/journal.py: una voce al giorno in
  docs/journal/YYYY-MM-DD.md — mercato (ritorni, RV30, TSMOM sugli orizzonti
  di produzione, DVOL con eta'), libro (TP01/SKH01, target, posizione, leva),
  P&L (equity del venue come autorita', scomposizione locale), salute.
  NIENTE narrativa automatica: il campo `nota` e' l'unico posto per il testo
  libero ed e' dell'operatore, mai riscritto da un ricalcolo.
- book_execute.py: ts_utc = ora vera del fill, bar_ts = barra. Test di
  regressione sulla sorgente: se qualcuno rimette last_data, il test lo dice.
- 62 voci di giornale ricostruite dall'arming a oggi.

Tre difetti trovati dai test mentre scrivevo, non a occhio: il renderer cadeva
in KeyError se mancava il blocco mercato (un giornale che non si scrive non e'
un giornale); "24 giri attesi" su un giorno IN CORSO produceva un allarme a
ogni esecuzione; e libro e P&L leggevano due istanti diversi, quindi la stessa
pagina mostrava due equity.

Strategia, pesi, config INVARIATI. Nessun ordine. 659 test passano.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adriano Dal Pastro
2026-08-23 13:13:02 +00:00
parent 0cd0747e95
commit 10c373075c
72 changed files with 3228 additions and 1 deletions
+4
View File
@@ -86,3 +86,7 @@ data/live/
# dati esterni di ricerca (on-chain CoinMetrics community, F&G) — non certificati, non in git
data/external/
data/options_daily/
# libro di bordo: il DB e' dato operativo (coperto dal backup), non codice
data/live/trades.db
data/cache_regime_capitale.json
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-06-23
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $62,684.00 | -1.99% | -4.48% | -18.57% | 42.8% | ↓ ↓ ↓ (0/3 su) | 41.6 (27° pctl 1a) |
| **ETH** | $1,665.60 | -3.52% | -7.05% | -20.59% | 63.4% | ↓ ↓ ↓ (0/3 su) | 56.2 (21° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-06-23 · 2 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (2 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 2/24 — **22 mancanti**
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-06-24
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $60,977.50 | -2.72% | -5.39% | -21.09% | 43.3% | ↓ ↓ ↓ (0/3 su) | 45.1 (51° pctl 1a) |
| **ETH** | $1,619.90 | -2.74% | -7.43% | -23.29% | 63.6% | ↓ ↓ ↓ (0/3 su) | 58.8 (28° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-06-24 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-06-25
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $59,702.00 | -2.09% | -5.08% | -21.25% | 43.3% | ↓ ↓ ↓ (0/3 su) | 46.6 (57° pctl 1a) |
| **ETH** | $1,564.90 | -3.40% | -8.47% | -24.43% | 64.1% | ↓ ↓ ↓ (0/3 su) | 60.8 (33° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-06-25 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-06-26
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $60,017.00 | +0.53% | -5.47% | -19.28% | 43.4% | ↓ ↓ ↓ (0/3 su) | 45.5 (52° pctl 1a) |
| **ETH** | $1,576.05 | +0.71% | -7.82% | -22.08% | 64.1% | ↓ ↓ ↓ (0/3 su) | 59.8 (30° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-06-26 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-06-27
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $59,956.00 | -0.10% | -6.67% | -18.47% | 43.4% | ↓ ↓ ↓ (0/3 su) | 45.2 (52° pctl 1a) |
| **ETH** | $1,570.80 | -0.33% | -9.67% | -21.76% | 64.2% | ↓ ↓ ↓ (0/3 su) | 59.9 (31° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-06-27 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-06-28
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $59,503.50 | -0.75% | -5.92% | -18.92% | 43.4% | ↓ ↓ ↓ (0/3 su) | 47.7 (63° pctl 1a) |
| **ETH** | $1,569.20 | -0.10% | -8.01% | -22.04% | 64.1% | ↓ ↓ ↓ (0/3 su) | 61.3 (37° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-06-28 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-06-29
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $60,166.50 | +1.11% | -5.92% | -18.46% | 43.6% | ↓ ↓ ↓ (0/3 su) | 42.6 (33° pctl 1a) |
| **ETH** | $1,611.20 | +2.68% | -6.68% | -20.24% | 65.1% | ↓ ↓ ↓ (0/3 su) | 57.9 (26° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-06-29 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (23 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-06-30
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $58,546.50 | -2.69% | -6.60% | -20.44% | 44.2% | ↓ ↓ ↓ (0/3 su) | 44.5 (46° pctl 1a) |
| **ETH** | $1,570.55 | -2.52% | -5.71% | -21.67% | 65.4% | ↓ ↓ ↓ (0/3 su) | 59.0 (29° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-06-30 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-01
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $59,961.50 | +2.42% | -1.67% | -15.93% | 44.6% | ↓ ↓ ↓ (0/3 su) | 42.9 (36° pctl 1a) |
| **ETH** | $1,607.95 | +2.38% | -0.74% | -19.81% | 66.3% | ↓ ↓ ↓ (0/3 su) | 56.9 (23° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-01 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-02
*Scritto 2026-08-23T13:08:26+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $61,518.50 | +2.60% | +3.04% | -7.71% | 40.0% | ↓ ↓ ↓ (0/3 su) | 40.5 (21° pctl 1a) |
| **ETH** | $1,698.60 | +5.64% | +8.54% | -8.57% | 64.9% | ↓ ↓ ↓ (0/3 su) | 55.1 (16° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-02 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-03
*Scritto 2026-08-23T13:08:27+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $62,542.00 | +1.66% | +4.21% | -2.28% | 38.1% | ↓ ↓ ↓ (0/3 su) | 39.5 (14° pctl 1a) |
| **ETH** | $1,757.15 | +3.45% | +11.49% | -2.98% | 65.6% | ↓ ↓ ↓ (0/3 su) | 53.5 (8° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-03 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-04
*Scritto 2026-08-23T13:08:27+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,080.00 | +0.86% | +5.21% | -1.15% | 38.2% | ↓ ↓ ↓ (0/3 su) | 39.2 (13° pctl 1a) |
| **ETH** | $1,779.40 | +1.27% | +13.28% | +0.56% | 65.3% | ↑ ↓ ↓ (1/3 su) | 53.0 (6° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-04 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-05
*Scritto 2026-08-23T13:08:27+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,624.00 | +0.86% | +6.92% | +4.22% | 34.9% | ↑ ↓ ↓ (1/3 su) | 38.7 (10° pctl 1a) |
| **ETH** | $1,784.95 | +0.31% | +13.75% | +12.77% | 51.3% | ↑ ↓ ↓ (1/3 su) | 53.1 (6° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-05 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-06
*Scritto 2026-08-23T13:08:27+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,012.00 | +0.61% | +6.39% | +5.19% | 34.8% | ↑ ↓ ↓ (1/3 su) | 37.3 (4° pctl 1a) |
| **ETH** | $1,798.85 | +0.78% | +11.65% | +14.67% | 51.1% | ↑ ↓ ↓ (1/3 su) | 52.6 (6° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-06 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-07
*Scritto 2026-08-23T13:08:27+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,322.00 | -1.08% | +8.16% | +0.03% | 32.3% | ↑ ↓ ↓ (1/3 su) | 38.9 (12° pctl 1a) |
| **ETH** | $1,770.30 | -1.59% | +12.72% | +4.79% | 45.0% | ↑ ↓ ↓ (1/3 su) | 53.3 (7° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-07 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (23 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-08
*Scritto 2026-08-23T13:08:27+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $62,259.00 | -1.68% | +3.83% | -1.27% | 32.8% | ↓ ↓ ↓ (0/3 su) | 39.5 (16° pctl 1a) |
| **ETH** | $1,742.25 | -1.58% | +8.35% | +3.14% | 45.4% | ↑ ↓ ↓ (1/3 su) | 53.4 (8° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-08 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-09
*Scritto 2026-08-23T13:08:27+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,200.00 | +1.51% | +2.73% | +2.42% | 32.3% | ↑ ↓ ↓ (1/3 su) | 37.3 (5° pctl 1a) |
| **ETH** | $1,744.25 | +0.11% | +2.69% | +6.49% | 43.9% | ↑ ↓ ↓ (1/3 su) | 52.0 (5° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-08 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (15 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-10
*Scritto 2026-08-23T13:08:27+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,136.00 | +1.48% | +2.55% | +4.36% | 32.6% | ↑ ↓ ↓ (1/3 su) | 36.2 (2° pctl 1a) |
| **ETH** | $1,796.05 | +2.97% | +2.21% | +10.82% | 44.7% | ↑ ↓ ↓ (1/3 su) | 49.8 (4° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-08 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-11
*Scritto 2026-08-23T13:08:27+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,804.50 | -0.52% | +1.15% | +0.36% | 30.5% | ↑ ↓ ↓ (1/3 su) | 36.8 (4° pctl 1a) |
| **ETH** | $1,787.15 | -0.50% | +0.44% | +6.93% | 43.7% | ↑ ↓ ↓ (1/3 su) | 50.6 (4° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-08 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-12
*Scritto 2026-08-23T13:08:28+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,759.50 | -0.07% | +0.21% | +0.33% | 30.5% | ↑ ↓ ↓ (1/3 su) | 37.2 (5° pctl 1a) |
| **ETH** | $1,805.70 | +1.04% | +1.16% | +8.40% | 43.7% | ↑ ↓ ↓ (1/3 su) | 51.0 (5° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-08 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-13
*Scritto 2026-08-23T13:08:28+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $62,265.50 | -2.34% | -2.73% | -3.34% | 31.2% | ↓ ↓ ↓ (0/3 su) | 37.8 (8° pctl 1a) |
| **ETH** | $1,775.55 | -1.67% | -1.30% | +5.67% | 44.2% | ↑ ↓ ↓ (1/3 su) | 51.1 (6° pctl 1a) |
## Libro
Equity **$598.06** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-08 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+0.00**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-14
*Scritto 2026-08-23T13:08:28+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $65,012.00 | +4.41% | +2.67% | -1.08% | 34.1% | ↓ ↓ ↓ (0/3 su) | 36.5 (3° pctl 1a) |
| **ETH** | $1,889.60 | +6.42% | +6.74% | +9.53% | 48.3% | ↑ ↓ ↓ (1/3 su) | 49.5 (3° pctl 1a) |
## Libro
Equity **$598.49** · nozionale lordo $75 · leva lorda 0.13x · barra dati 2026-07-08 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | LONG @ 1,868.9 | $+75 | $+75 | HOLD (a target) |
## P&L
- giorno: **$+0.43** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 1 fill · fee 0.0374
- cumulato dall'arming: **$+0.43**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-15
*Scritto 2026-08-23T13:08:28+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,734.50 | -0.43% | +3.98% | -2.35% | 34.0% | ↓ ↓ ↓ (0/3 su) | 36.0 (1° pctl 1a) |
| **ETH** | $1,916.70 | +1.43% | +10.01% | +6.73% | 46.6% | ↑ ↓ ↓ (1/3 su) | 49.0 (2° pctl 1a) |
## Libro
Equity **$600.14** · nozionale lordo $77 · leva lorda 0.13x · barra dati 2026-07-15 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | LONG @ 1,868.9 | $+75 | $+77 | HOLD (a target) |
## P&L
- giorno: **$+1.65** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$+2.08**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-16
*Scritto 2026-08-23T13:08:28+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,804.50 | -1.44% | +0.96% | -2.77% | 34.1% | ↓ ↓ ↓ (0/3 su) | 36.4 (3° pctl 1a) |
| **ETH** | $1,863.55 | -2.77% | +6.84% | +4.00% | 47.7% | ↑ ↓ ↓ (1/3 su) | 49.2 (2° pctl 1a) |
## Libro
Equity **$597.93** · nozionale lordo $75 · leva lorda 0.13x · barra dati 2026-07-16 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | LONG @ 1,868.9 | $+75 | $+75 | HOLD (a target) |
## P&L
- giorno: **$-2.21** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.13**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-17
*Scritto 2026-08-23T13:08:28+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,904.00 | +0.16% | -0.36% | -0.85% | 33.6% | ↓ ↓ ↓ (0/3 su) | 36.3 (3° pctl 1a) |
| **ETH** | $1,841.00 | -1.21% | +2.50% | +5.21% | 47.1% | ↑ ↓ ↓ (1/3 su) | 49.0 (2° pctl 1a) |
## Libro
Equity **$596.77** · nozionale lordo $74 · leva lorda 0.12x · barra dati 2026-07-17 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | LONG @ 1,868.9 | $+75 | $+74 | HOLD (a target) |
## P&L
- giorno: **$-1.16** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.29**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-18
*Scritto 2026-08-23T13:08:28+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,810.00 | +1.42% | +1.58% | +3.04% | 32.8% | ↑ ↓ ↓ (1/3 su) | 35.7 (1° pctl 1a) |
| **ETH** | $1,861.75 | +1.13% | +4.17% | +8.89% | 46.4% | ↑ ↓ ↓ (1/3 su) | 49.3 (4° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-18 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.15** di equity (24 letture)
- realizzato: -1.10 netto su 1 round-trip chiusi · 1 fill · fee 0.0369
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-19
*Scritto 2026-08-23T13:08:28+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,704.50 | -0.16% | +1.48% | +1.92% | 32.7% | ↑ ↓ ↓ (1/3 su) | 36.1 (3° pctl 1a) |
| **ETH** | $1,871.60 | +0.53% | +3.65% | +9.47% | 46.4% | ↑ ↓ ↓ (1/3 su) | 49.7 (6° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-19 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-20
*Scritto 2026-08-23T13:08:28+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $65,216.50 | +0.79% | +4.74% | +1.52% | 32.5% | ↑ ↓ ↓ (1/3 su) | 36.3 (4° pctl 1a) |
| **ETH** | $1,903.45 | +1.70% | +7.20% | +9.46% | 46.4% | ↑ ↓ ↓ (1/3 su) | 50.4 (7° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-20 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-21
*Scritto 2026-08-23T13:08:29+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $66,532.50 | +2.02% | +2.34% | +5.19% | 32.7% | ↑ ↓ ↓ (1/3 su) | 37.3 (10° pctl 1a) |
| **ETH** | $1,929.10 | +1.35% | +2.09% | +13.09% | 45.8% | ↑ ↓ ↓ (1/3 su) | 51.0 (8° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-21 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-22
*Scritto 2026-08-23T13:08:29+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $66,081.00 | -0.68% | +2.08% | +3.32% | 32.6% | ↑ ↓ ↓ (1/3 su) | 38.0 (12° pctl 1a) |
| **ETH** | $1,933.70 | +0.24% | +0.89% | +12.00% | 45.7% | ↑ ↓ ↓ (1/3 su) | 51.6 (10° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-22 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-23
*Scritto 2026-08-23T13:08:29+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $65,060.00 | -1.55% | +1.97% | +3.79% | 32.3% | ↑ ↓ ↓ (1/3 su) | 38.5 (14° pctl 1a) |
| **ETH** | $1,877.45 | -2.91% | +0.75% | +12.72% | 45.1% | ↑ ↓ ↓ (1/3 su) | 51.6 (10° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-23 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-24
*Scritto 2026-08-23T13:08:29+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,103.50 | -1.47% | +0.31% | +5.13% | 31.1% | ↑ ↓ ↓ (1/3 su) | 37.0 (7° pctl 1a) |
| **ETH** | $1,860.50 | -0.90% | +1.06% | +14.85% | 43.9% | ↑ ↓ ↓ (1/3 su) | 50.5 (7° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-24 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: non misurata
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-25
*Scritto 2026-08-23T13:08:29+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,327.50 | +0.35% | -0.74% | +7.75% | 30.0% | ↑ ↓ ↓ (1/3 su) | 37.7 (11° pctl 1a) |
| **ETH** | $1,873.45 | +0.70% | +0.63% | +19.72% | 41.5% | ↑ ↓ ↓ (1/3 su) | 51.5 (10° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-25 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-26
*Scritto 2026-08-23T13:08:29+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $65,357.50 | +1.60% | +1.01% | +8.90% | 30.4% | ↑ ↓ ↓ (1/3 su) | 37.3 (10° pctl 1a) |
| **ETH** | $1,953.65 | +4.28% | +4.38% | +23.96% | 43.4% | ↑ ↓ ↓ (1/3 su) | 51.7 (11° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-26 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-27
*Scritto 2026-08-23T13:08:29+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,710.50 | -2.52% | -2.31% | +6.26% | 31.9% | ↑ ↓ ↓ (1/3 su) | 37.5 (11° pctl 1a) |
| **ETH** | $1,891.00 | -3.21% | -0.65% | +20.38% | 45.4% | ↑ ↓ ↓ (1/3 su) | 51.9 (12° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-27 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+33
View File
@@ -0,0 +1,33 @@
# Giornale di bordo — 2026-07-28
*Scritto 2026-08-23T13:08:29+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,874.50 | +0.26% | -4.00% | +7.35% | 31.7% | ↑ ↓ ↓ (1/3 su) | 37.2 (8° pctl 1a) |
| **ETH** | $1,920.40 | +1.55% | -0.45% | +22.38% | 45.5% | ↑ ↓ ↓ (1/3 su) | 53.0 (14° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-28 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-29
*Scritto 2026-08-23T13:08:29+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,933.00 | +0.09% | -3.25% | +6.26% | 31.6% | ↑ ↓ ↓ (1/3 su) | 37.5 (11° pctl 1a) |
| **ETH** | $1,909.10 | -0.59% | -1.27% | +18.49% | 45.1% | ↑ ↓ ↓ (1/3 su) | 52.5 (13° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-29 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (21 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-30
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,745.50 | +1.27% | -0.48% | +10.59% | 30.0% | ↑ ↓ ↓ (1/3 su) | 35.5 (1° pctl 1a) |
| **ETH** | $1,917.45 | +0.44% | +2.13% | +22.09% | 43.7% | ↑ ↓ ↓ (1/3 su) | 50.7 (8° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-30 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-07-31
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $62,837.00 | -2.95% | -1.98% | +4.80% | 31.2% | ↑ ↓ ↓ (1/3 su) | 35.6 (1° pctl 1a) |
| **ETH** | $1,861.50 | -2.92% | +0.05% | +15.77% | 45.0% | ↑ ↓ ↓ (1/3 su) | 50.2 (6° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-07-31 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-01
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $62,776.00 | -0.10% | -2.41% | +2.04% | 29.9% | ↑ ↓ ↓ (1/3 su) | 35.5 (1° pctl 1a) |
| **ETH** | $1,843.25 | -0.98% | -1.61% | +8.52% | 41.5% | ↑ ↓ ↓ (1/3 su) | 50.8 (9° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-01 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-02
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,524.50 | +1.19% | -2.80% | +1.57% | 29.7% | ↑ ↓ ↓ (1/3 su) | 35.0 (0° pctl 1a) |
| **ETH** | $1,883.90 | +2.21% | -3.57% | +7.21% | 40.5% | ↑ ↓ ↓ (1/3 su) | 49.7 (6° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-02 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-03
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,485.50 | -0.06% | -0.35% | +0.64% | 29.5% | ↑ ↓ ↓ (1/3 su) | 34.8 (0° pctl 1a) |
| **ETH** | $1,859.25 | -1.31% | -1.68% | +4.49% | 40.7% | ↑ ↓ ↓ (1/3 su) | 49.2 (2° pctl 1a) |
## Libro
Equity **$596.92** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-03 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-1.14**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-04
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,054.50 | +0.90% | +0.28% | +0.68% | 29.5% | ↑ ↓ ↑ (2/3 su) | 34.0 (0° pctl 1a) |
| **ETH** | $1,868.75 | +0.51% | -2.69% | +4.69% | 40.7% | ↑ ↓ ↑ (2/3 su) | 47.8 (0° pctl 1a) |
## Libro
Equity **$597.37** · nozionale lordo $37 · leva lorda 0.06x · barra dati 2026-08-04 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.162 | flat | $+36 | $+37 | HOLD (a target) |
## P&L
- giorno: **$+0.45** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 1 fill · fee 0.0129
- cumulato dall'arming: **$-0.69**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-05
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,607.50 | +0.86% | +1.06% | +0.93% | 29.6% | ↑ ↓ ↓ (1/3 su) | 34.7 (1° pctl 1a) |
| **ETH** | $1,907.45 | +2.07% | -0.09% | +6.04% | 41.2% | ↑ ↓ ↓ (1/3 su) | 48.0 (1° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-05 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$-0.25** di equity (23 letture)
- realizzato: +0.21 netto su 1 round-trip chiusi · 1 fill · fee 0.0130
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-06
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,284.50 | -0.50% | -0.71% | +1.52% | 29.4% | ↑ ↓ ↓ (1/3 su) | 35.0 (2° pctl 1a) |
| **ETH** | $1,902.65 | -0.25% | -0.77% | +7.48% | 40.7% | ↑ ↓ ↓ (1/3 su) | 48.0 (1° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-06 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-07
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,884.00 | +0.93% | +3.26% | +4.22% | 28.9% | ↑ ↓ ↓ (1/3 su) | 33.9 (0° pctl 1a) |
| **ETH** | $1,913.50 | +0.57% | +2.79% | +9.83% | 40.2% | ↑ ↓ ↓ (1/3 su) | 47.4 (0° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-07 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-08
*Scritto 2026-08-23T13:08:30+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,918.50 | +0.05% | +3.41% | +2.72% | 28.4% | ↑ ↓ ↓ (1/3 su) | 34.2 (1° pctl 1a) |
| **ETH** | $1,916.00 | +0.13% | +3.95% | +9.85% | 40.2% | ↑ ↓ ↓ (1/3 su) | 48.1 (2° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-08 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-09
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,869.00 | -0.08% | +2.12% | +1.14% | 28.0% | ↑ ↓ ↓ (1/3 su) | 34.9 (2° pctl 1a) |
| **ETH** | $1,909.50 | -0.34% | +1.36% | +6.32% | 39.1% | ↑ ↓ ↓ (1/3 su) | 49.1 (4° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-09 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-10
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,931.50 | -1.45% | +0.70% | +0.20% | 28.4% | ↑ ↓ ↓ (1/3 su) | 36.3 (8° pctl 1a) |
| **ETH** | $1,871.25 | -2.00% | +0.65% | +4.71% | 39.8% | ↑ ↓ ↓ (1/3 su) | 49.7 (8° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-10 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-11
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,559.50 | -0.58% | -0.77% | -0.31% | 28.5% | ↓ ↓ ↓ (0/3 su) | 36.1 (8° pctl 1a) |
| **ETH** | $1,881.25 | +0.53% | +0.67% | +4.18% | 39.7% | ↑ ↓ ↓ (1/3 su) | 49.3 (7° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-11 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (23 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-12
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,440.00 | -0.19% | -1.81% | +1.89% | 27.2% | ↑ ↓ ↓ (1/3 su) | 35.8 (6° pctl 1a) |
| **ETH** | $1,878.15 | -0.16% | -1.54% | +5.78% | 39.2% | ↑ ↓ ↓ (1/3 su) | 49.4 (8° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-12 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-13
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,453.00 | +0.02% | -1.29% | -2.40% | 22.5% | ↓ ↓ ↓ (0/3 su) | 34.8 (2° pctl 1a) |
| **ETH** | $1,885.15 | +0.37% | -0.92% | -0.24% | 32.6% | ↓ ↓ ↓ (0/3 su) | 48.5 (2° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-13 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-14
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $62,994.50 | -0.72% | -2.91% | -2.69% | 22.6% | ↓ ↓ ↓ (0/3 su) | 34.7 (2° pctl 1a) |
| **ETH** | $1,880.30 | -0.26% | -1.74% | -1.90% | 32.2% | ↓ ↓ ↓ (0/3 su) | 47.2 (0° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-14 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-15
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $63,033.00 | +0.06% | -2.90% | -1.21% | 22.0% | ↓ ↓ ↓ (0/3 su) | 35.0 (4° pctl 1a) |
| **ETH** | $1,880.85 | +0.03% | -1.83% | +0.93% | 30.7% | ↑ ↓ ↓ (1/3 su) | 47.5 (1° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-15 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-16
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $62,841.50 | -0.30% | -3.13% | -1.66% | 22.0% | ↓ ↓ ↓ (0/3 su) | 35.2 (5° pctl 1a) |
| **ETH** | $1,874.50 | -0.34% | -1.83% | +1.82% | 30.4% | ↑ ↓ ↓ (1/3 su) | 47.5 (1° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-16 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-17
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,487.50 | +2.62% | +0.87% | -0.50% | 23.4% | ↓ ↓ ↓ (0/3 su) | 34.7 (2° pctl 1a) |
| **ETH** | $1,912.35 | +2.02% | +2.20% | +2.72% | 30.9% | ↑ ↓ ↓ (1/3 su) | 46.3 (0° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-17 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-18
*Scritto 2026-08-23T13:08:31+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $64,693.50 | +0.32% | +1.78% | -0.02% | 23.4% | ↓ ↓ ↓ (0/3 su) | 34.9 (4° pctl 1a) |
| **ETH** | $1,917.10 | +0.25% | +1.91% | +2.43% | 30.9% | ↑ ↓ ↓ (1/3 su) | 46.1 (0° pctl 1a) |
## Libro
Equity **$597.12** · nozionale lordo $0 · leva lorda 0.00x · barra dati 2026-08-18 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+0.00** di equity (22 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 0 fill · fee 0.0000
- cumulato dall'arming: **$-0.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-19
*Scritto 2026-08-23T13:08:32+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $69,327.00 | +7.16% | +9.28% | +6.30% | 33.6% | ↑ ↓ ↑ (2/3 su) | 37.8 (21° pctl 1a) |
| **ETH** | $2,252.30 | +17.48% | +19.92% | +18.33% | 63.8% | ↑ ↑ ↑ (3/3 su) | 52.5 (21° pctl 1a) |
## Libro
Equity **$610.82** · nozionale lordo $76 · leva lorda 0.12x · barra dati 2026-08-19 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.000 | LONG @ 68,510.0 | $+76 | $+76 | HOLD (a target) |
| **ETH** | +0.000 | flat | $+0 | $+0 | HOLD (a target) |
## P&L
- giorno: **$+13.70** di equity (24 letture)
- realizzato: +10.60 netto su 1 round-trip chiusi · 3 fill · fee 0.0816
- cumulato dall'arming: **$+12.76**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-20
*Scritto 2026-08-23T13:08:32+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $73,010.50 | +5.31% | +15.06% | +9.74% | 37.3% | ↑ ↓ ↑ (2/3 su) | 39.4 (33° pctl 1a) |
| **ETH** | $2,326.65 | +3.30% | +23.42% | +20.61% | 64.4% | ↑ ↑ ↑ (3/3 su) | 52.6 (22° pctl 1a) |
## Libro
Equity **$620.63** · nozionale lordo $272 · leva lorda 0.44x · barra dati 2026-08-20 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.199 | LONG @ 68,510.0 | $+124 | $+124 | HOLD (a target) |
| **ETH** | +0.294 | LONG @ 2,251.8 | $+146 | $+148 | HOLD (a target) |
## P&L
- giorno: **$+9.81** di equity (24 letture)
- realizzato: +0.51 netto su 1 round-trip chiusi · 4 fill · fee 0.0698
- cumulato dall'arming: **$+22.57**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-21
*Scritto 2026-08-23T13:08:32+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $78,350.50 | +7.31% | +24.38% | +18.57% | 43.9% | ↑ ↑ ↑ (3/3 su) | 43.3 (57° pctl 1a) |
| **ETH** | $2,517.10 | +8.19% | +33.87% | +30.17% | 69.2% | ↑ ↑ ↑ (3/3 su) | 57.7 (46° pctl 1a) |
## Libro
Equity **$644.00** · nozionale lordo $196 · leva lorda 0.30x · barra dati 2026-08-21 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.176 | LONG @ 75,280.0 | $+123 | $+126 | HOLD (a target) |
| **ETH** | +0.291 | flat | $+70 | $+70 | HOLD (a target) |
## P&L
- giorno: **$+23.37** di equity (24 letture)
- realizzato: +18.90 netto su 6 round-trip chiusi · 5 fill · fee 0.0867
- cumulato dall'arming: **$+45.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-22
*Scritto 2026-08-23T13:08:32+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $77,103.50 | -1.59% | +22.32% | +18.51% | 43.9% | ↑ ↑ ↑ (3/3 su) | 42.3 (51° pctl 1a) |
| **ETH** | $2,423.10 | -3.73% | +28.83% | +29.06% | 69.8% | ↑ ↑ ↑ (3/3 su) | 57.0 (44° pctl 1a) |
## Libro
Equity **$635.00** · nozionale lordo $327 · leva lorda 0.51x · barra dati 2026-08-22 · 24 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.450 | LONG @ 75,280.0 | $+186 | $+185 | HOLD (a target) |
| **ETH** | +0.277 | LONG @ 2,436.4 | $+145 | $+142 | HOLD (a target) |
## P&L
- giorno: **$-9.00** di equity (24 letture)
- realizzato: +0.00 netto su 0 round-trip chiusi · 2 fill · fee 0.0489
- cumulato dall'arming: **$+36.94**
## Salute
- giri di `book_execute`: 24/24
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+34
View File
@@ -0,0 +1,34 @@
# Giornale di bordo — 2026-08-23
*Scritto 2026-08-23T13:08:32+00:00. Numeri misurati; nessuna interpretazione automatica.*
## Mercato
| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |
|---|---|---|---|---|---|---|---|
| **BTC** | $77,254.50 | +0.20% | +22.94% | +20.52% | 43.3% | ↑ ↓ ↑ (2/3 su) | 42.4 (52° pctl 1a) |
| **ETH** | $2,427.20 | +0.17% | +29.49% | +30.46% | 69.6% | ↑ ↑ ↑ (3/3 su) | 57.0 (44° pctl 1a) |
## Libro
Equity **$636.14** · nozionale lordo $258 · leva lorda 0.41x · barra dati 2026-08-23 · 14 giri
| | TP01 | SKH01 | target | posizione | azione |
|---|---|---|---|---|---|
| **BTC** | +0.150 | LONG @ 75,280.0 | $+115 | $+116 | HOLD (a target) |
| **ETH** | +0.271 | LONG @ 2,436.4 | $+144 | $+142 | HOLD (a target) |
## P&L
- giorno: **$+1.14** di equity (14 letture)
- realizzato: +5.55 netto su 2 round-trip chiusi · 1 fill · fee 0.0243
- cumulato dall'arming: **$+38.08**
## Salute
- giri di `book_execute`: 14/14 *(giorno in corso)*
- eta' feed SKH all'ultimo giro: 0 min
## Nota
*(vuota — campo dell'operatore)*
+4
View File
@@ -20,5 +20,9 @@ mkdir -p logs
# = allarme inviato); l'azione a un allarme e' manuale, vedi src/live/venue_watch.py.
uv run python scripts/live/venue_watch.py --quiet || true
uv run python scripts/live/book_execute.py --execute
# Libro di bordo: materializza in data/live/trades.db (che il backup COPRE) l'ora vera dei
# fill, che altrimenti vive solo in questo log — gitignored, fuori dal backup e ruotabile.
# Va DOPO book_execute: dentro lo stesso blocco vede le righe appena scritte.
uv run python scripts/live/trades_db.py --sync --quiet || true
echo "===== done $(date -u '+%H:%M:%SZ') ====="
} >> logs/cron_book.log 2>&1
+4
View File
@@ -39,5 +39,9 @@ mkdir -p logs
# decidono su queste serie: un monitor fermo produce silenzio, e il silenzio sembra uno zero.
# Va DOPO tutti i monitor, altrimenti misura lo stato di ieri.
uv run python scripts/live/monitor_health.py --quiet || true
# Giornale di bordo. Gira alle 00:30 UTC -> chiude IERI (giorno completo) e apre OGGI.
# Sola lettura: feed certificato, cron_book.log, trades.db. Il campo `nota` non lo tocca.
uv run python scripts/live/journal.py --giorno "$(date -u -d yesterday +%F)" --quiet || true
uv run python scripts/live/journal.py --quiet || true
echo "===== done $(date -u '+%H:%M:%SZ') ====="
} >> logs/cron_daily.log 2>&1
+8 -1
View File
@@ -23,6 +23,8 @@ import json
import sys
from pathlib import Path
from datetime import datetime, timezone
import pandas as pd
PROJECT_ROOT = Path(__file__).resolve().parents[2]
@@ -210,7 +212,12 @@ def _run():
for f in fills:
print(f" -> {f.side.upper()} {f.filled:.4f} @ ${f.price or 0:,.1f} fee {f.fee_usdc:.5f} "
f"({'OK' if f.verified else 'NON VERIFICATO: ' + f.notes})")
log_event(dict(ts_utc=str(pd.Timestamp(r['last_data'])), asset=asset, action=act,
# `ts_utc` = ORA VERA del fill. Fino al 2026-08-23 qui c'era la data della
# BARRA di segnale (`r['last_data']`): 19 righe su 19 a 00:00:00, e un trade
# registrato SEI GIORNI prima di essere eseguito (ETH 0.04 del 14/07, scritto
# 08/07). La barra resta, sotto il suo nome: `bar_ts`.
log_event(dict(ts_utc=datetime.now(timezone.utc).isoformat(timespec="seconds"),
bar_ts=str(pd.Timestamp(r['last_data'])), asset=asset, action=act,
side=f.side, filled=f.filled, price=f.price, fee=f.fee_usdc,
verified=f.verified, notes=f.notes, net_target=net, pos_after=newpos,
tp_frac=a["tp_frac"], skh_sign=a["skh_sign"]))
+67
View File
@@ -0,0 +1,67 @@
"""Giornale di bordo: scrive la voce del giorno nel DB e in `docs/journal/YYYY-MM-DD.md`.
uv run python scripts/live/journal.py # voce di oggi
uv run python scripts/live/journal.py --giorno 2026-08-21
uv run python scripts/live/journal.py --backfill 60 # ricostruisce gli ultimi N giorni
uv run python scripts/live/journal.py --nota "testo" # annota il giorno (operatore)
SOLA LETTURA su feed, log e venue: non tocca il libro, non manda ordini.
Il campo `nota` e' l'UNICO posto per il testo libero, e non viene mai riscritto da un
ricalcolo automatico.
"""
from __future__ import annotations
import sys
from datetime import date, datetime, timedelta, timezone
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from src.live import journal as J # noqa: E402
from src.live import tradesdb as T # noqa: E402
def _arg(flag: str, default=None):
a = sys.argv[1:]
return a[a.index(flag) + 1] if flag in a and a.index(flag) + 1 < len(a) else default
def una(con, g: date, nota: str | None = None, verbose: bool = True) -> Path:
voce = J.costruisci(con, g)
J.salva(con, voce, nota=nota)
f = J.scrivi_file(con, voce)
if verbose:
p = voce["pnl"]
d = p.get("delta_equity")
print(f" {g} equity {p.get('equity_fine') or float('nan'):,.2f} "
f"({'n/d' if d is None else f'{d:+.2f}'}) "
f"fill {p['fill']} · rt {p['roundtrip_chiusi']} · giri {voce['salute']['giri_book']}/24"
f" -> {f.relative_to(ROOT)}")
return f
if __name__ == "__main__":
# sincronizzare PRIMA: altrimenti la sezione 'Libro' (letta dal log) e la sezione 'P&L'
# (letta dal DB) descrivono due istanti diversi e la pagina si contraddice da sola.
sys.path.insert(0, str(ROOT / "scripts" / "live"))
from trades_db import sync as _sync
_sync(verbose=False)
con = T.connect()
nota = _arg("--nota")
if (n := _arg("--backfill")):
oggi = datetime.now(timezone.utc).date()
for i in range(int(n), -1, -1):
g = oggi - timedelta(days=i)
v = J.costruisci(con, g)
# un giorno senza giri di book non e' una voce: e' assenza di dato
if v["salute"]["giri_book"] == 0:
continue
J.salva(con, v); J.scrivi_file(con, v)
tot = con.execute("SELECT COUNT(*) c FROM journal").fetchone()["c"]
print(f" voci nel giornale: {tot}")
else:
g = date.fromisoformat(_arg("--giorno", datetime.now(timezone.utc).date().isoformat()))
una(con, g, nota=nota, verbose="--quiet" not in sys.argv[1:])
con.close()
+105
View File
@@ -0,0 +1,105 @@
"""Sincronizza `data/live/trades.db` — il libro di bordo dei trade, allineato col tempo.
uv run python scripts/live/trades_db.py --sync # idempotente, da cron
uv run python scripts/live/trades_db.py --report # stato + P&L a video
uv run python scripts/live/trades_db.py --reconcile # incrocio delle tre fonti
SOLA LETTURA sul venue e sui log: non manda ordini, non tocca il libro.
Il DB sta in `data/live/`, che il backup rotativo della VPS gia' copre — a differenza di
`logs/cron_book.log`, che e' oggi l'unica sede dell'ora vera dei fill.
"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from src.live import tradesdb as T # noqa: E402
def sync(verbose: bool = True) -> dict:
con = T.connect()
runs = T.parse_cron_log(T.CRON_LOG.read_text(errors="replace")) if T.CRON_LOG.exists() else []
fills = [f for r in runs for f in r.fills]
n_f = T.upsert_fills(con, fills)
n_e = T.upsert_equity(con, [(r.ts_utc, r.equity, "cron_book") for r in runs if r.equity is not None])
n_r = T.rebuild_roundtrips(con)
if runs:
T.set_meta(con, "ultimo_giro", runs[-1].ts_utc)
T.set_meta(con, "ultimo_sync", T.ora())
tot = con.execute("SELECT COUNT(*) c FROM fills").fetchone()["c"]
tot_e = con.execute("SELECT COUNT(*) c FROM equity").fetchone()["c"]
if verbose:
print(f" fills: +{n_f} (totale {tot}) | equity: +{n_e} (totale {tot_e}) | round-trip {n_r}")
con.close()
return dict(nuovi_fill=n_f, nuovi_equity=n_e, roundtrip=n_r, totale_fill=tot)
def reconcile() -> None:
runs = T.parse_cron_log(T.CRON_LOG.read_text(errors="replace"))
fills = [f for r in runs for f in r.fills]
righe = T.parse_executions_jsonl(T.EXEC_JSONL.read_text()) if T.EXEC_JSONL.exists() else []
rec = T.reconcile(fills, righe)
print(f"\n cron_book.log : {len(fills)} fill (con ORA VERA)")
print(f" book_executions : {len(righe)} righe (senza ora)")
print(f" concordano : {len(rec['ok'])}")
print(f" solo nel log : {len(rec['solo_log'])}")
print(f" solo nel jsonl : {len(rec['solo_jsonl'])}")
print(f" prezzi divergenti : {len(rec['prezzi_divergenti'])} (oltre l'arrotondamento di stampa)")
for f in rec["solo_log"]:
print(f" solo-log {f.ts_utc} {f.asset} {f.side} {f.qty} @ {f.price}")
for r in rec["solo_jsonl"]:
print(f" solo-jsonl {r['ts_utc'][:10]} {r['asset']} {r['side']} {r['filled']} @ {r['price']}")
# il venue: autorevole ma TRONCATO -> si riporta cosa vede, non lo si usa per riparare
try:
from src.live.deribit import DeribitRead
d = DeribitRead()
for ins in ("BTC_USDC-PERPETUAL", "ETH_USDC-PERPETUAL"):
t = d.trade_history(ins, limit=100)
print(f" venue {ins:<20}: {len(t)} trade visibili (l'endpoint TRONCA: non e' un backfill)")
except Exception as e:
print(f" venue: NON LETTO ({type(e).__name__}) — non e' 'zero trade', e' 'non misurato'")
def report() -> None:
con = T.connect()
n = con.execute("SELECT COUNT(*) c FROM fills").fetchone()["c"]
if not n:
print(" DB vuoto: lanciare --sync"); return
p = con.execute("SELECT MIN(ts_utc) a, MAX(ts_utc) b FROM fills").fetchone()
print(f"\n fill registrati : {n} dal {p['a'][:16]} al {p['b'][:16]}")
eq = con.execute("SELECT ts_utc, equity FROM equity ORDER BY ts_utc").fetchall()
if eq:
e0, e1 = eq[0]["equity"], eq[-1]["equity"]
picco = max(r["equity"] for r in eq)
print(f" equity : ${e0:,.2f} -> ${e1:,.2f} ({e1 - e0:+.2f}, {100*(e1/e0-1):+.2f}%)"
f" | picco ${picco:,.2f} | {len(eq)} letture")
rt = con.execute("SELECT * FROM roundtrips ORDER BY ts_out").fetchall()
lordo = sum(r["pnl_lordo"] for r in rt)
fee_rt = sum(r["fee_quota"] for r in rt)
fee_tot = con.execute("SELECT COALESCE(SUM(fee),0) s FROM fills").fetchone()["s"]
vinc = sum(1 for r in rt if r["pnl_netto"] > 0)
print(f" round-trip chiusi : {len(rt)} ({vinc} in utile) "
f"lordo {lordo:+.2f} | fee allocate {fee_rt:.2f} | netto {lordo - fee_rt:+.2f}")
print(f" fee totali pagate : {fee_tot:.4f}")
ap = T.stato_aperto(con)
if ap:
print(" posizioni aperte :")
for a, d in sorted(ap.items()):
print(f" {a} {d['qty']:.4f} @ medio ${d['prezzo_medio']:,.2f} (dal {d['dal'][:16]})")
else:
print(" posizioni aperte : nessuna (flat)")
print(f" ultimo sync : {T.get_meta(con, 'ultimo_sync', 'mai')}")
con.close()
if __name__ == "__main__":
args = sys.argv[1:]
if "--reconcile" in args:
reconcile()
elif "--report" in args:
report()
else:
sync(verbose="--quiet" not in args)
+233
View File
@@ -0,0 +1,233 @@
"""Giornale di bordo del libro live: una voce al giorno, MISURATA.
REGOLA DI QUESTO MODULO: il giornale registra NUMERI e stati derivati dai numeri.
Non scrive narrativa di mercato, non interpreta, non prevede. Il campo `nota` esiste
apposta per il testo libero dell'operatore, ed e' l'unico posto dove puo' finire un'opinione:
resta vuoto se nessuno lo scrive. *Un giornale che si inventa la lettura del mercato smette
di essere una misura e diventa un racconto — e fra sei mesi non si distingue piu' quale delle
due cose si stava leggendo.*
TRE STATI, mai due: ogni grandezza e' un numero, oppure `None` con una ragione. Un dato
mancante NON diventa zero (lezione `paper_dvolspread` / `venue_watch`: "non vedo" non e'
"va tutto bene").
"""
from __future__ import annotations
import json
import math
from datetime import date, datetime, timedelta, timezone
from pathlib import Path
import numpy as np
import pandas as pd
from src.live import tradesdb as T
PROJECT_ROOT = Path(__file__).resolve().parents[2]
JOURNAL_DIR = PROJECT_ROOT / "docs" / "journal"
ASSETS = ("BTC", "ETH")
# Gli orizzonti del segnale TP01 in produzione (trend_portfolio: TSMOM 30/90/180 giorni).
ORIZZONTI = (30, 90, 180)
def _giornaliero(df: pd.DataFrame) -> pd.Series:
s = df.set_index(pd.to_datetime(df["timestamp"], unit="ms", utc=True))["close"]
return s.resample("1D").last().dropna()
def _rv_annua(px: pd.Series, n: int = 30) -> float | None:
r = np.log(px).diff().dropna()
if len(r) < n:
return None
return float(r.tail(n).std(ddof=1) * math.sqrt(365) * 100)
def metriche_mercato(giorno: date) -> dict:
"""Stato del mercato al `giorno`, dal feed CERTIFICATO. Nessuna chiamata di rete."""
from src.data.downloader import load_data
out: dict = {}
for a in ASSETS:
try:
px = _giornaliero(load_data(a, "1h"))
except Exception as e:
out[a] = dict(errore=f"feed non leggibile: {type(e).__name__}")
continue
px = px[px.index.date <= giorno]
if px.empty:
out[a] = dict(errore="nessuna barra fino al giorno richiesto")
continue
ult = float(px.iloc[-1])
d = dict(chiusura=ult, barra=str(px.index[-1].date()))
for k, n in (("ret_1g", 1), ("ret_7g", 7), ("ret_30g", 30)):
d[k] = float(px.iloc[-1] / px.iloc[-1 - n] - 1) * 100 if len(px) > n else None
d["rv30_annua"] = _rv_annua(px)
# gli stessi orizzonti del segnale di produzione: e' lo stato che il libro LEGGE
d["tsmom"] = {f"{n}g": (None if len(px) <= n else int(np.sign(px.iloc[-1] / px.iloc[-1 - n] - 1)))
for n in ORIZZONTI}
segni = [v for v in d["tsmom"].values() if v is not None]
d["tsmom_su"] = (sum(1 for v in segni if v > 0), len(segni)) if segni else None
# DVOL: se il file non c'e' o e' vecchio -> None con ragione, mai 0
f = PROJECT_ROOT / "data" / "raw" / f"dvol_{a.lower()}.parquet"
if f.exists():
dv = pd.read_parquet(f)
dv.index = pd.to_datetime(dv["timestamp"], unit="ms", utc=True)
dv = dv[dv.index.date <= giorno]["close"]
if len(dv):
eta = (giorno - dv.index[-1].date()).days
d["dvol"] = float(dv.iloc[-1]) if eta <= 2 else None
d["dvol_eta_g"] = eta
if len(dv) >= 252 and eta <= 2:
d["dvol_rank_1a"] = float((dv.tail(252) < dv.iloc[-1]).mean())
else:
d["dvol"] = None; d["dvol_nota"] = "nessuna barra DVOL <= giorno"
else:
d["dvol"] = None; d["dvol_nota"] = "file DVOL assente"
out[a] = d
return out
def stato_libro(con, giorno: date) -> dict:
"""Ultimo giro di `book_execute` del giorno: cosa il libro vedeva e teneva."""
runs = T.parse_cron_log(T.CRON_LOG.read_text(errors="replace")) if T.CRON_LOG.exists() else []
g = [r for r in runs if r.ts_utc[:10] == giorno.isoformat()]
if not g:
return dict(errore="nessun giro di book_execute quel giorno", giri=0)
ult = g[-1]
lordo = sum(abs(v.get("pos", 0.0)) for v in ult.stato_asset.values())
return dict(giri=len(g), ultimo_giro=ult.ts_utc, equity=ult.equity, barra=ult.last_bar,
feed_skh_min=ult.feed_min, nozionale_lordo=lordo,
leva_lorda=(lordo / ult.equity if ult.equity else None),
asset={a: dict(tp_frac=v["tp_frac"], skh_sign=v["skh_sign"],
skh_entry=v.get("skh_entry"), target=v["net"], posizione=v["pos"],
azione=v["azione"]) for a, v in ult.stato_asset.items()})
def pnl_giorno(con, giorno: date) -> dict:
"""P&L del giorno. `equity` e' l'autorita' (venue); il resto e' scomposizione locale."""
g = giorno.isoformat()
eq = con.execute("SELECT ts_utc, equity FROM equity WHERE ts_utc LIKE ? ORDER BY ts_utc",
(f"{g}%",)).fetchall()
prima = con.execute("SELECT equity FROM equity WHERE ts_utc < ? ORDER BY ts_utc DESC LIMIT 1",
(g,)).fetchone()
e_ini = prima["equity"] if prima else (eq[0]["equity"] if eq else None)
e_fin = eq[-1]["equity"] if eq else None
rt = con.execute("SELECT * FROM roundtrips WHERE ts_out LIKE ?", (f"{g}%",)).fetchall()
fills = con.execute("SELECT * FROM fills WHERE ts_utc LIKE ?", (f"{g}%",)).fetchall()
e_arm = con.execute("SELECT equity FROM equity ORDER BY ts_utc LIMIT 1").fetchone()
return dict(
equity_inizio=e_ini, equity_fine=e_fin,
delta_equity=(e_fin - e_ini) if (e_ini is not None and e_fin is not None) else None,
realizzato_lordo=sum(r["pnl_lordo"] for r in rt) if rt else 0.0,
realizzato_netto=sum(r["pnl_netto"] for r in rt) if rt else 0.0,
roundtrip_chiusi=len(rt), fill=len(fills),
fee=sum(f["fee"] for f in fills) if fills else 0.0,
cumulato_da_arming=(e_fin - e_arm["equity"]) if (e_fin is not None and e_arm) else None,
letture_equity=len(eq))
def salute(con, giorno: date) -> dict:
"""Giri attesi: 24 per un giorno CHIUSO, le ore trascorse per quello in corso.
Un giorno in corso confrontato con 24 produce un allarme a ogni esecuzione — e un
allarme che scatta sempre e' un allarme che non verra' letto il giorno che e' vero.
"""
lb = stato_libro(con, giorno)
adesso = datetime.now(timezone.utc)
in_corso = giorno == adesso.date()
atteso = (adesso.hour + 1) if in_corso else 24
fatti = lb.get("giri", 0)
return dict(giri_book=fatti, feed_skh_min=lb.get("feed_skh_min"), atteso_giri=atteso,
giorno_in_corso=in_corso, giri_mancanti=max(0, atteso - fatti))
def costruisci(con, giorno: date) -> dict:
return dict(giorno=giorno.isoformat(), ts_scritto=T.ora(),
mercato=metriche_mercato(giorno), libro=stato_libro(con, giorno),
pnl=pnl_giorno(con, giorno), salute=salute(con, giorno))
def salva(con, voce: dict, nota: str | None = None) -> None:
esistente = con.execute("SELECT nota FROM journal WHERE giorno=?", (voce["giorno"],)).fetchone()
# la nota dell'operatore NON viene mai sovrascritta da un ricalcolo automatico
nota_finale = nota if nota is not None else (esistente["nota"] if esistente else "")
con.execute("""INSERT INTO journal (giorno, ts_scritto, mercato, libro, pnl, salute, nota)
VALUES (?,?,?,?,?,?,?)
ON CONFLICT(giorno) DO UPDATE SET
ts_scritto=excluded.ts_scritto, mercato=excluded.mercato,
libro=excluded.libro, pnl=excluded.pnl, salute=excluded.salute,
nota=excluded.nota""",
(voce["giorno"], voce["ts_scritto"], json.dumps(voce["mercato"]),
json.dumps(voce["libro"]), json.dumps(voce["pnl"]),
json.dumps(voce["salute"]), nota_finale))
con.commit()
def _n(v, fmt="{:+.2f}", vuoto="n/d"):
return vuoto if v is None else fmt.format(v)
def rendi_markdown(con, voce: dict) -> str:
g, m, lb, p, s = voce["giorno"], voce["mercato"], voce["libro"], voce["pnl"], voce["salute"]
nota = con.execute("SELECT nota FROM journal WHERE giorno=?", (g,)).fetchone()
nota = nota["nota"] if nota else ""
L = [f"# Giornale di bordo — {g}", "",
f"*Scritto {voce['ts_scritto']}. Numeri misurati; nessuna interpretazione automatica.*", "",
"## Mercato", "",
"| | chiusura | 1g | 7g | 30g | RV30 ann. | TSMOM 30/90/180 | DVOL |",
"|---|---|---|---|---|---|---|---|"]
for a in ASSETS:
d = m.get(a) or {}
# tre stati: misurato / errore dichiarato / blocco assente. Nessuno dei tre e' uno zero,
# e l'ultimo non deve far cadere la pagina (un giornale che non si scrive non e' un giornale).
if "errore" in d or "chiusura" not in d:
perche = d.get("errore", "blocco mercato assente")
L.append(f"| **{a}** | n/d | n/d | n/d | n/d | n/d | n/d | {perche} |"); continue
ts = d.get("tsmom", {})
segni = " ".join("" if ts.get(f"{n}g") == 1 else "" if ts.get(f"{n}g") == -1 else "·"
for n in ORIZZONTI)
su = d.get("tsmom_su")
dv = f"{d['dvol']:.1f}" if d.get("dvol") is not None else f"n/d ({d.get('dvol_nota','vecchio')})"
if d.get("dvol_rank_1a") is not None:
dv += f" ({100*d['dvol_rank_1a']:.0f}° pctl 1a)"
L.append(f"| **{a}** | ${d['chiusura']:,.2f} | {_n(d.get('ret_1g'),'{:+.2f}%')} | "
f"{_n(d.get('ret_7g'),'{:+.2f}%')} | {_n(d.get('ret_30g'),'{:+.2f}%')} | "
f"{_n(d.get('rv30_annua'),'{:.1f}%')} | {segni}"
f"{f' ({su[0]}/{su[1]} su)' if su else ''} | {dv} |")
L += ["", "## Libro", ""]
if "errore" in lb:
L.append(f"⚠️ {lb['errore']}")
else:
L += [f"Equity **${lb['equity']:,.2f}** · nozionale lordo ${lb['nozionale_lordo']:,.0f} "
f"· leva lorda {_n(lb.get('leva_lorda'),'{:.2f}x')} · barra dati {lb['barra']} "
f"· {lb['giri']} giri", "",
"| | TP01 | SKH01 | target | posizione | azione |", "|---|---|---|---|---|---|"]
for a, v in sorted(lb["asset"].items()):
if v["skh_sign"] == 0:
sk = "flat"
else:
sk = "LONG" if v["skh_sign"] > 0 else "SHORT"
if v.get("skh_entry"):
sk += " @ {:,.1f}".format(v["skh_entry"])
L.append(f"| **{a}** | {v['tp_frac']:+.3f} | {sk} | ${v['target']:+,.0f} | "
f"${v['posizione']:+,.0f} | {v['azione']} |")
L += ["", "## P&L", "",
f"- giorno: **{_n(p.get('delta_equity'),'${:+,.2f}')}** di equity "
f"({p['letture_equity']} letture)",
f"- realizzato: {p['realizzato_netto']:+.2f} netto su {p['roundtrip_chiusi']} round-trip "
f"chiusi · {p['fill']} fill · fee {p['fee']:.4f}",
f"- cumulato dall'arming: **{_n(p.get('cumulato_da_arming'),'${:+,.2f}')}**", "",
"## Salute", "",
f"- giri di `book_execute`: {s['giri_book']}/{s['atteso_giri']}"
+ (" *(giorno in corso)*" if s.get("giorno_in_corso") else "")
+ (f" — **{s['giri_mancanti']} mancanti**" if s["giri_mancanti"] else ""),
f"- eta' feed SKH all'ultimo giro: "
+ (f"{s['feed_skh_min']} min" if s["feed_skh_min"] is not None else "non misurata"),
"", "## Nota", "", (nota if nota.strip() else "*(vuota — campo dell'operatore)*"), ""]
return "\n".join(L)
def scrivi_file(con, voce: dict) -> Path:
JOURNAL_DIR.mkdir(parents=True, exist_ok=True)
f = JOURNAL_DIR / f"{voce['giorno']}.md"
f.write_text(rendi_markdown(con, voce))
return f
+351
View File
@@ -0,0 +1,351 @@
"""Libro di bordo del book live: DB dei trade ALLINEATO COL TEMPO + serie di equity.
PERCHE' ESISTE
--------------
`data/live/book_executions.jsonl` registra i fill, ma il suo `ts_utc` e' la data della
**barra di segnale** (`book_execute.py`: `pd.Timestamp(r['last_data'])`), non l'ora del fill:
19 righe su 19 a `00:00:00`. L'ora vera sta solo in `logs/cron_book.log` — che e' **gitignored,
non nel backup e ruotabile**. Quindi oggi la cronologia reale del libro live vive in un file
che una rotazione cancella, e nessuno se ne accorgerebbe.
Questo modulo MATERIALIZZA quella cronologia in `data/live/trades.db` (sqlite), che sta dentro
il perimetro gia' coperto dal backup rotativo della VPS.
FONTI, in ordine di autorita' — e nessuna delle tre e' completa da sola
----------------------------------------------------------------------
1. `logs/cron_book.log` -> ORA VERA del giro + contesto (equity, tp_frac, skh, target, posizione)
e la riga di fill `-> BUY 0.0008 @ $78,094.2 fee 0.02187 (OK)`.
2. `data/live/book_executions.jsonl` -> gli stessi fill con piu' cifre, ma senza ora.
3. venue (`DeribitRead.trade_history`) -> autorevole su `order_id` e timestamp in ms,
**ma tronca**: al 2026-08-23 ritorna 1 trade su BTC e 0 su ETH.
Le tre si INCROCIANO, non si sovrascrivono: `reconcile()` riporta le divergenze e non ripara
niente da solo (una riparazione silenziosa fra due fonti che non concordano e' un'invenzione).
TRE STATI, non due: un fill puo' essere `ok` (le fonti concordano), `solo-log`, `solo-jsonl`.
"Non lo vedo" non e' "non c'e'".
"""
from __future__ import annotations
import hashlib
import json
import re
import sqlite3
from dataclasses import dataclass, field
from datetime import datetime, timezone
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[2]
DB_PATH = PROJECT_ROOT / "data" / "live" / "trades.db"
CRON_LOG = PROJECT_ROOT / "logs" / "cron_book.log"
EXEC_JSONL = PROJECT_ROOT / "data" / "live" / "book_executions.jsonl"
# Data di armamento dell'esecuzione reale (CLAUDE.md, 2026-06-20).
ARMING = "2026-06-20"
SCHEMA = """
CREATE TABLE IF NOT EXISTS fills (
fill_id TEXT PRIMARY KEY,
ts_utc TEXT NOT NULL,
ts_source TEXT NOT NULL,
bar_ts TEXT,
asset TEXT NOT NULL,
side TEXT NOT NULL,
qty REAL NOT NULL,
price REAL NOT NULL,
fee REAL NOT NULL,
action TEXT,
net_target REAL,
pos_before REAL,
pos_after REAL,
tp_frac REAL,
skh_sign INTEGER,
skh_entry REAL,
equity REAL,
order_id TEXT,
verified INTEGER,
stato TEXT NOT NULL DEFAULT 'ok'
);
CREATE INDEX IF NOT EXISTS ix_fills_ts ON fills(ts_utc);
CREATE TABLE IF NOT EXISTS roundtrips (
rt_id INTEGER PRIMARY KEY AUTOINCREMENT,
asset TEXT NOT NULL,
qty REAL NOT NULL,
ts_in TEXT NOT NULL,
px_in REAL NOT NULL,
ts_out TEXT NOT NULL,
px_out REAL NOT NULL,
ore_tenuta REAL,
pnl_lordo REAL NOT NULL,
fee_quota REAL NOT NULL,
pnl_netto REAL NOT NULL
);
CREATE TABLE IF NOT EXISTS equity (
ts_utc TEXT PRIMARY KEY,
equity REAL NOT NULL,
src TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS journal (
giorno TEXT PRIMARY KEY,
ts_scritto TEXT NOT NULL,
mercato TEXT,
libro TEXT,
pnl TEXT,
salute TEXT,
nota TEXT NOT NULL DEFAULT ''
);
CREATE TABLE IF NOT EXISTS meta (k TEXT PRIMARY KEY, v TEXT);
"""
# =============================================================================================
# parsing — puro, nessun I/O: prende testo, ritorna dati
# =============================================================================================
@dataclass
class Fill:
ts_utc: str
asset: str
side: str
qty: float
price: float
fee: float
ts_source: str = "cron_log"
bar_ts: str | None = None
action: str | None = None
net_target: float | None = None
pos_before: float | None = None
pos_after: float | None = None
tp_frac: float | None = None
skh_sign: int | None = None
skh_entry: float | None = None
equity: float | None = None
order_id: str | None = None
verified: int = 1
@property
def fill_id(self) -> str:
raw = f"{self.ts_utc}|{self.asset}|{self.side}|{self.qty:.10f}|{self.price:.6f}"
return hashlib.sha1(raw.encode()).hexdigest()[:16]
@dataclass
class Run:
"""Un giro orario di `book_execute`."""
ts_utc: str
equity: float | None = None
last_bar: str | None = None
feed_min: int | None = None
fills: list[Fill] = field(default_factory=list)
stato_asset: dict = field(default_factory=dict)
_RE_HEAD = re.compile(r"^===== (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z) cron_book =====$")
_RE_EQ = re.compile(r"conto reale\s*:\s*\$([\d,\.]+)")
_RE_BAR = re.compile(r"ultima barra\s*:\s*(\S+)")
_RE_FEED = re.compile(r"feed SKH\s*:\s*\w+ \((\d+) min\)")
_RE_SIG = re.compile(
r"^\s*(BTC|ETH) TP ([+-][\d\.]+) · SKH ([+-]\d+)\(([^)]*)\) -> net \$([+-][\d,]+) "
r"\| pos \$([+-][\d,]+) -> (.+?)\s*$")
_RE_FILL = re.compile(
r"^\s*-> (BUY|SELL) ([\d\.]+) @ \$([\d,\.]+) fee ([\d\.]+) \((OK|NON VERIFICATO[^)]*)\)")
def _num(s: str) -> float:
return float(s.replace(",", "").replace("$", ""))
def parse_cron_log(text: str) -> list[Run]:
"""Estrae i giri da `cron_book.log`. L'ORA del blocco e' l'ora vera del fill."""
runs: list[Run] = []
cur: Run | None = None
ultimo_asset: str | None = None
for line in text.splitlines():
m = _RE_HEAD.match(line)
if m:
cur = Run(ts_utc=m.group(1).replace("Z", "+00:00"))
runs.append(cur)
ultimo_asset = None
continue
if cur is None:
continue
if (m := _RE_EQ.search(line)) and cur.equity is None:
cur.equity = _num(m.group(1)); continue
if (m := _RE_BAR.search(line)) and cur.last_bar is None:
cur.last_bar = m.group(1); continue
if (m := _RE_FEED.search(line)) and cur.feed_min is None:
cur.feed_min = int(m.group(1)); continue
if (m := _RE_SIG.match(line)):
asset = m.group(1)
entry = None
sk = m.group(4)
if "@" in sk:
try:
entry = float(sk.split("@", 1)[1])
except ValueError:
entry = None
cur.stato_asset[asset] = dict(
tp_frac=float(m.group(2)), skh_sign=int(m.group(3)), skh_entry=entry,
net=_num(m.group(5)), pos=_num(m.group(6)), azione=m.group(7).strip())
ultimo_asset = asset
continue
if (m := _RE_FILL.match(line)) and ultimo_asset:
st = cur.stato_asset.get(ultimo_asset, {})
cur.fills.append(Fill(
ts_utc=cur.ts_utc, asset=ultimo_asset, side=m.group(1).lower(),
qty=float(m.group(2)), price=_num(m.group(3)), fee=float(m.group(4)),
bar_ts=cur.last_bar, action=st.get("azione"), net_target=st.get("net"),
pos_before=st.get("pos"), tp_frac=st.get("tp_frac"),
skh_sign=st.get("skh_sign"), skh_entry=st.get("skh_entry"),
equity=cur.equity, verified=1 if m.group(5) == "OK" else 0))
return runs
def parse_executions_jsonl(text: str) -> list[dict]:
return [json.loads(l) for l in text.splitlines() if l.strip()]
def reconcile(fills_log: list[Fill], righe_jsonl: list[dict], tol_px: float = 0.51) -> dict:
"""Incrocia le due fonti su (data, asset, side, qty). NON ripara: riporta.
`tol_px`: i prezzi del log sono arrotondati a 1 decimale in stampa -> confronto con
tolleranza, e la divergenza sopra tolleranza si REGISTRA invece di essere assorbita.
"""
def chiave(g, a, s, q):
return (g, a, s, round(float(q), 8))
ix_log: dict = {}
for f in fills_log:
ix_log.setdefault(chiave(f.ts_utc[:10], f.asset, f.side, f.qty), []).append(f)
ix_js: dict = {}
for r in righe_jsonl:
ix_js.setdefault(chiave(r["ts_utc"][:10], r["asset"], r["side"], r["filled"]), []).append(r)
ok, solo_log, solo_js, px_diversi = [], [], [], []
for k, gl in ix_log.items():
gj = ix_js.get(k, [])
for i, f in enumerate(gl):
if i < len(gj):
r = gj[i]
if abs(float(r["price"]) - f.price) > tol_px:
px_diversi.append((f, r))
ok.append((f, r))
else:
solo_log.append(f)
for k, gj in ix_js.items():
extra = len(gj) - len(ix_log.get(k, []))
for r in gj[max(0, len(gj) - extra):] if extra > 0 else []:
solo_js.append(r)
return dict(ok=ok, solo_log=solo_log, solo_jsonl=solo_js, prezzi_divergenti=px_diversi)
def fifo_roundtrips(fills: list[Fill]) -> tuple[list[dict], dict]:
"""Round-trip chiusi per FIFO + lotti residui. Le fee si allocano PRO-QUOTA sulla qty."""
from collections import deque, defaultdict
lotti: dict[str, deque] = defaultdict(deque)
rts: list[dict] = []
for f in sorted(fills, key=lambda x: (x.ts_utc, x.asset)):
fee_u = f.fee / f.qty if f.qty else 0.0
if f.side == "buy":
lotti[f.asset].append([f.qty, f.price, f.ts_utc, fee_u])
else:
resto = f.qty
while resto > 1e-12 and lotti[f.asset]:
lq, lp, lts, lfee_u = lotti[f.asset][0]
usa = min(resto, lq)
lordo = usa * (f.price - lp)
quota_fee = usa * (lfee_u + fee_u)
ore = (datetime.fromisoformat(f.ts_utc) - datetime.fromisoformat(lts)).total_seconds() / 3600
rts.append(dict(asset=f.asset, qty=usa, ts_in=lts, px_in=lp, ts_out=f.ts_utc,
px_out=f.price, ore_tenuta=ore, pnl_lordo=lordo,
fee_quota=quota_fee, pnl_netto=lordo - quota_fee))
lq -= usa; resto -= usa
if lq <= 1e-12:
lotti[f.asset].popleft()
else:
lotti[f.asset][0][0] = lq
aperti = {a: [dict(qty=q, price=p, ts=t) for q, p, t, _ in dq] for a, dq in lotti.items() if dq}
return rts, aperti
# =============================================================================================
# persistenza
# =============================================================================================
def connect(path: Path | str = DB_PATH) -> sqlite3.Connection:
path = Path(path)
path.parent.mkdir(parents=True, exist_ok=True)
con = sqlite3.connect(path)
con.row_factory = sqlite3.Row
con.executescript(SCHEMA)
return con
def upsert_fills(con: sqlite3.Connection, fills: list[Fill]) -> int:
n = 0
for f in fills:
cur = con.execute(
"""INSERT INTO fills (fill_id, ts_utc, ts_source, bar_ts, asset, side, qty, price, fee,
action, net_target, pos_before, pos_after, tp_frac, skh_sign,
skh_entry, equity, order_id, verified, stato)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
ON CONFLICT(fill_id) DO NOTHING""",
(f.fill_id, f.ts_utc, f.ts_source, f.bar_ts, f.asset, f.side, f.qty, f.price, f.fee,
f.action, f.net_target, f.pos_before, f.pos_after, f.tp_frac, f.skh_sign,
f.skh_entry, f.equity, f.order_id, f.verified, "ok"))
n += cur.rowcount
con.commit()
return n
def upsert_equity(con: sqlite3.Connection, punti: list[tuple[str, float, str]]) -> int:
n = 0
for ts, v, src in punti:
cur = con.execute("INSERT INTO equity (ts_utc, equity, src) VALUES (?,?,?) "
"ON CONFLICT(ts_utc) DO NOTHING", (ts, v, src))
n += cur.rowcount
con.commit()
return n
def rebuild_roundtrips(con: sqlite3.Connection) -> int:
"""Ricalcola da zero: i round-trip sono DERIVATI, mai inseriti a mano."""
righe = con.execute("SELECT * FROM fills ORDER BY ts_utc, asset").fetchall()
fills = [Fill(ts_utc=r["ts_utc"], asset=r["asset"], side=r["side"], qty=r["qty"],
price=r["price"], fee=r["fee"]) for r in righe]
rts, _ = fifo_roundtrips(fills)
con.execute("DELETE FROM roundtrips")
con.executemany(
"""INSERT INTO roundtrips (asset, qty, ts_in, px_in, ts_out, px_out, ore_tenuta,
pnl_lordo, fee_quota, pnl_netto)
VALUES (:asset,:qty,:ts_in,:px_in,:ts_out,:px_out,:ore_tenuta,
:pnl_lordo,:fee_quota,:pnl_netto)""", rts)
con.commit()
return len(rts)
def set_meta(con: sqlite3.Connection, k: str, v: str) -> None:
con.execute("INSERT INTO meta (k,v) VALUES (?,?) ON CONFLICT(k) DO UPDATE SET v=excluded.v", (k, v))
con.commit()
def get_meta(con: sqlite3.Connection, k: str, default=None):
r = con.execute("SELECT v FROM meta WHERE k=?", (k,)).fetchone()
return r["v"] if r else default
def stato_aperto(con: sqlite3.Connection) -> dict:
righe = con.execute("SELECT * FROM fills ORDER BY ts_utc, asset").fetchall()
fills = [Fill(ts_utc=r["ts_utc"], asset=r["asset"], side=r["side"], qty=r["qty"],
price=r["price"], fee=r["fee"]) for r in righe]
_, aperti = fifo_roundtrips(fills)
out = {}
for a, lotti in aperti.items():
q = sum(x["qty"] for x in lotti)
costo = sum(x["qty"] * x["price"] for x in lotti)
out[a] = dict(qty=q, prezzo_medio=costo / q if q else 0.0, dal=min(x["ts"] for x in lotti))
return out
def ora() -> str:
return datetime.now(timezone.utc).isoformat(timespec="seconds")
+138
View File
@@ -0,0 +1,138 @@
"""Il giornale di bordo: tre stati invece di due, e la nota dell'operatore che non si perde.
Il rischio di un giornale automatico non e' sbagliare un numero: e' scrivere `0` dove il dato
non c'era, e leggerlo fra sei mesi come una misura.
"""
from __future__ import annotations
import json
import sys
from datetime import date, datetime, timedelta, timezone
from pathlib import Path
import pandas as pd
import pytest
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
from src.live import journal as J # noqa: E402
from src.live import tradesdb as T # noqa: E402
@pytest.fixture()
def db(tmp_path):
con = T.connect(tmp_path / "t.db")
yield con
con.close()
# ------------------------------------------------- i giri attesi non sono sempre 24
def test_giorno_in_corso_non_e_un_giorno_bucato(db, monkeypatch):
"""24 giri attesi su un giorno non finito = allarme a ogni esecuzione, cioe' rumore."""
oggi = datetime.now(timezone.utc).date()
monkeypatch.setattr(J, "stato_libro", lambda c, g: dict(giri=datetime.now(timezone.utc).hour + 1,
feed_skh_min=0))
s = J.salute(db, oggi)
assert s["giorno_in_corso"] is True
assert s["atteso_giri"] == datetime.now(timezone.utc).hour + 1
assert s["giri_mancanti"] == 0
def test_giorno_chiuso_si_giudica_su_24(db, monkeypatch):
monkeypatch.setattr(J, "stato_libro", lambda c, g: dict(giri=20, feed_skh_min=0))
s = J.salute(db, date(2026, 8, 21))
assert s["giorno_in_corso"] is False
assert s["atteso_giri"] == 24 and s["giri_mancanti"] == 4
def test_controllo_positivo_un_giorno_davvero_bucato_viene_segnalato(db, monkeypatch):
monkeypatch.setattr(J, "stato_libro", lambda c, g: dict(giri=6, feed_skh_min=None))
assert J.salute(db, date(2026, 8, 21))["giri_mancanti"] == 18
# ------------------------------------------------- dato assente != zero
def test_dvol_assente_e_None_con_ragione_mai_zero(db, monkeypatch, tmp_path):
monkeypatch.setattr(J, "PROJECT_ROOT", tmp_path) # nessun file DVOL qui
(tmp_path / "data" / "raw").mkdir(parents=True)
m = J.metriche_mercato(date(2026, 8, 21))
for a in ("BTC", "ETH"):
if "errore" in m[a]:
continue
assert m[a]["dvol"] is None
assert m[a]["dvol_nota"] == "file DVOL assente" # la ragione, non un valore
def test_giorno_senza_giri_e_un_errore_dichiarato_non_un_libro_vuoto(db, monkeypatch):
monkeypatch.setattr(T, "CRON_LOG", Path("/tmp/non-esiste-affatto.log"))
lb = J.stato_libro(db, date(2026, 8, 21))
assert "errore" in lb and lb["giri"] == 0
assert "equity" not in lb # non inventa uno zero
def test_pnl_senza_letture_di_equity_non_fabbrica_un_delta(db):
p = J.pnl_giorno(db, date(2026, 8, 21))
assert p["delta_equity"] is None and p["equity_fine"] is None
assert p["realizzato_netto"] == 0.0 and p["roundtrip_chiusi"] == 0 # 0 trade e' un fatto
# ------------------------------------------------- la nota dell'operatore
def test_la_nota_sopravvive_a_un_ricalcolo(db):
g = date(2026, 8, 21)
voce = dict(giorno=g.isoformat(), ts_scritto=T.ora(), mercato={}, libro={}, pnl={}, salute={})
J.salva(db, voce, nota="rally post-CPI, non ho toccato niente")
J.salva(db, voce) # ricalcolo automatico
n = db.execute("SELECT nota FROM journal WHERE giorno=?", (g.isoformat(),)).fetchone()["nota"]
assert n == "rally post-CPI, non ho toccato niente"
def test_la_nota_si_puo_sostituire_esplicitamente(db):
g = date(2026, 8, 21)
voce = dict(giorno=g.isoformat(), ts_scritto=T.ora(), mercato={}, libro={}, pnl={}, salute={})
J.salva(db, voce, nota="prima")
J.salva(db, voce, nota="seconda")
n = db.execute("SELECT nota FROM journal WHERE giorno=?", (g.isoformat(),)).fetchone()["nota"]
assert n == "seconda"
# ------------------------------------------------- il markdown non mente
def test_il_markdown_dice_n_d_e_non_zero_quando_manca_il_dato(db):
voce = dict(giorno="2026-08-21", ts_scritto=T.ora(),
mercato={"BTC": {"errore": "feed non leggibile: FileNotFoundError"},
"ETH": {"errore": "feed non leggibile: FileNotFoundError"}},
libro={"errore": "nessun giro di book_execute quel giorno", "giri": 0},
pnl=J.pnl_giorno(db, date(2026, 8, 21)),
salute=dict(giri_book=0, feed_skh_min=None, atteso_giri=24,
giorno_in_corso=False, giri_mancanti=24))
J.salva(db, voce)
md = J.rendi_markdown(db, voce)
assert "n/d" in md and "24 mancanti" in md
assert "non misurata" in md # eta' feed sconosciuta
assert "$+0.00 di equity" not in md # niente zeri inventati
def test_il_markdown_riporta_il_segnale_che_il_libro_leggeva(db):
voce = dict(giorno="2026-08-21", ts_scritto=T.ora(), mercato={},
libro=dict(giri=24, ultimo_giro="2026-08-21T23:07:01+00:00", equity=644.0,
barra="2026-08-21", feed_skh_min=0, nozionale_lordo=196.0,
leva_lorda=0.304,
asset={"BTC": dict(tp_frac=0.176, skh_sign=1, skh_entry=75280.0,
target=123.0, posizione=126.0, azione="HOLD (a target)")}),
pnl=J.pnl_giorno(db, date(2026, 8, 21)),
salute=dict(giri_book=24, feed_skh_min=0, atteso_giri=24,
giorno_in_corso=False, giri_mancanti=0))
J.salva(db, voce)
md = J.rendi_markdown(db, voce)
assert "+0.176" in md and "LONG @ 75,280.0" in md and "0.30x" in md
def test_lo_stato_tsmom_usa_gli_orizzonti_di_produzione():
"""Il giornale deve riportare CIO' CHE IL LIBRO LEGGE, non un trend a caso."""
from src.strategies import trend_portfolio as tp
src = Path(tp.__file__).read_text()
for n in J.ORIZZONTI:
assert str(n) in src, f"orizzonte {n} non compare in trend_portfolio.py"
+207
View File
@@ -0,0 +1,207 @@
"""Il libro di bordo dei trade: parsing, FIFO, riconciliazione, idempotenza.
Ogni rilevatore ha il suo CONTROLLO POSITIVO: un parser che non estrae mai niente e uno che
estrae tutto passano gli stessi test pigri, e nessuno dei due sta misurando qualcosa.
"""
from __future__ import annotations
import sqlite3
import sys
from datetime import date, datetime, timedelta, timezone
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
from src.live import tradesdb as T # noqa: E402
LOG_FINTO = """===== 2026-08-20T04:07:01Z cron_book =====
modo : ESECUZIONE REALE
conto reale : $610.82
ultima barra : 2026-08-20
feed SKH : fresco (3 min)
BTC TP +0.199 · SKH +1(LONG@66475.9) -> net $+122 | pos $+76 -> BUY $+46
-> BUY 0.0007 @ $69,351.8 fee 0.01699 (OK)
ETH TP +0.294 · SKH +0(flat) -> net $+67 | pos $+0 -> BUY $+67
-> BUY 0.0298 @ $2,257.9 fee 0.02355 (OK)
===== done 04:07:14Z =====
===== 2026-08-20T05:07:01Z cron_book =====
conto reale : $611.90
ultima barra : 2026-08-20
feed SKH : fresco (0 min)
BTC TP +0.199 · SKH +1(LONG@66475.9) -> net $+123 | pos $+123 -> HOLD (a target)
ETH TP +0.294 · SKH +0(flat) -> net $+67 | pos $+67 -> HOLD (a target)
=> Nessuna azione: conto gia' al target netto del book.
===== done 05:07:11Z =====
"""
# ---------------------------------------------------------------- parsing del log
def test_estrae_ora_vera_e_non_la_barra():
runs = T.parse_cron_log(LOG_FINTO)
assert len(runs) == 2
f = runs[0].fills[0]
assert f.ts_utc.startswith("2026-08-20T04:07:01") # ora del giro
assert f.bar_ts == "2026-08-20" # barra, sotto il suo nome
assert f.ts_utc[:10] != "" and "T" in f.ts_utc # non e' una data nuda
def test_estrae_contesto_del_segnale():
r = T.parse_cron_log(LOG_FINTO)[0]
assert r.equity == 610.82 and r.feed_min == 3
f = [x for x in r.fills if x.asset == "BTC"][0]
assert f.tp_frac == 0.199 and f.skh_sign == 1 and f.skh_entry == 66475.9
assert f.net_target == 122 and f.pos_before == 76
assert f.qty == 0.0007 and f.price == 69351.8 and f.fee == 0.01699
assert f.verified == 1
def test_controllo_positivo_un_giro_senza_fill_non_ne_inventa():
"""Il secondo giro e' un HOLD: se il parser tornasse fill anche li', non starebbe leggendo."""
runs = T.parse_cron_log(LOG_FINTO)
assert len(runs[1].fills) == 0
assert runs[1].stato_asset["BTC"]["azione"] == "HOLD (a target)"
def test_fill_non_verificato_resta_marcato():
log = LOG_FINTO.replace("fee 0.01699 (OK)", "fee 0.01699 (NON VERIFICATO: timeout)")
f = T.parse_cron_log(log)[0].fills[0]
assert f.verified == 0
def test_fill_id_deterministico_e_distingue_due_fill_simili():
a = T.Fill(ts_utc="2026-08-20T04:07:01+00:00", asset="BTC", side="buy", qty=0.0007, price=69351.8, fee=0.01)
b = T.Fill(ts_utc="2026-08-20T04:07:01+00:00", asset="BTC", side="buy", qty=0.0007, price=69351.8, fee=0.01)
c = T.Fill(ts_utc="2026-08-20T05:07:01+00:00", asset="BTC", side="buy", qty=0.0007, price=69351.8, fee=0.01)
assert a.fill_id == b.fill_id and a.fill_id != c.fill_id
# ---------------------------------------------------------------- FIFO
def _f(ts, asset, side, qty, price, fee=0.0):
return T.Fill(ts_utc=ts, asset=asset, side=side, qty=qty, price=price, fee=fee)
def test_fifo_chiude_nell_ordine_giusto_e_alloca_le_fee():
fills = [_f("2026-01-01T00:00:00+00:00", "BTC", "buy", 1.0, 100.0, 1.0),
_f("2026-01-02T00:00:00+00:00", "BTC", "buy", 1.0, 200.0, 1.0),
_f("2026-01-03T00:00:00+00:00", "BTC", "sell", 1.0, 300.0, 1.0)]
rts, aperti = T.fifo_roundtrips(fills)
assert len(rts) == 1
assert rts[0]["px_in"] == 100.0 # FIFO: chiude il PRIMO lotto
assert rts[0]["pnl_lordo"] == pytest.approx(200.0)
assert rts[0]["fee_quota"] == pytest.approx(2.0) # fee d'entrata + d'uscita, pro-quota
assert rts[0]["pnl_netto"] == pytest.approx(198.0)
assert rts[0]["ore_tenuta"] == pytest.approx(48.0)
assert aperti["BTC"][0]["price"] == 200.0 # resta il secondo lotto
def test_fifo_chiusura_parziale_spezza_il_lotto():
fills = [_f("2026-01-01T00:00:00+00:00", "ETH", "buy", 1.0, 100.0),
_f("2026-01-02T00:00:00+00:00", "ETH", "sell", 0.25, 120.0)]
rts, aperti = T.fifo_roundtrips(fills)
assert len(rts) == 1 and rts[0]["qty"] == pytest.approx(0.25)
assert rts[0]["pnl_lordo"] == pytest.approx(5.0)
assert aperti["ETH"][0]["qty"] == pytest.approx(0.75)
def test_fifo_non_mescola_gli_asset():
fills = [_f("2026-01-01T00:00:00+00:00", "BTC", "buy", 1.0, 100.0),
_f("2026-01-02T00:00:00+00:00", "ETH", "sell", 1.0, 100.0)]
rts, aperti = T.fifo_roundtrips(fills)
assert rts == [] # la vendita ETH non chiude il long BTC
assert set(aperti) == {"BTC"}
def test_fifo_riproduce_il_conto_del_libro_vero():
"""Controllo di realta' sui numeri gia' pubblicati: 12 round-trip, 11 in utile."""
if not T.CRON_LOG.exists():
pytest.skip("cron_book.log assente")
fills = [f for r in T.parse_cron_log(T.CRON_LOG.read_text(errors="replace")) for f in r.fills]
rts, _ = T.fifo_roundtrips(fills)
assert len(rts) >= 12
assert sum(1 for r in rts if r["pnl_netto"] > 0) >= 11
# ---------------------------------------------------------------- riconciliazione
def test_riconciliazione_scopre_lo_sfasamento_di_data():
"""IL difetto vero: il jsonl datava un trade alla BARRA, non al fill (14/07 scritto 08/07)."""
fills = [_f("2026-07-14T14:00:02+00:00", "ETH", "buy", 0.04, 1869.7)]
righe = [dict(ts_utc="2026-07-08 00:00:00", asset="ETH", side="buy", filled=0.04, price=1869.74)]
rec = T.reconcile(fills, righe)
assert len(rec["ok"]) == 0
assert len(rec["solo_log"]) == 1 and len(rec["solo_jsonl"]) == 1
def test_riconciliazione_controllo_positivo_quando_concordano():
"""Speculare del precedente: se le due fonti coincidono NON deve segnalare niente."""
fills = [_f("2026-08-20T04:07:01+00:00", "BTC", "buy", 0.0007, 69351.8)]
righe = [dict(ts_utc="2026-08-20 00:00:00", asset="BTC", side="buy", filled=0.0007, price=69351.8)]
rec = T.reconcile(fills, righe)
assert len(rec["ok"]) == 1 and not rec["solo_log"] and not rec["solo_jsonl"]
assert not rec["prezzi_divergenti"]
def test_riconciliazione_segnala_un_prezzo_davvero_diverso_non_l_arrotondamento():
base = dict(asset="BTC", side="buy", filled=0.0007, ts_utc="2026-08-20 00:00:00")
f = [_f("2026-08-20T04:07:01+00:00", "BTC", "buy", 0.0007, 69351.8)]
assert not T.reconcile(f, [dict(base, price=69351.84)])["prezzi_divergenti"] # stampa a 1 dec.
assert T.reconcile(f, [dict(base, price=69400.00)])["prezzi_divergenti"] # divergenza vera
# ---------------------------------------------------------------- persistenza
@pytest.fixture()
def db(tmp_path):
con = T.connect(tmp_path / "t.db")
yield con
con.close()
def test_upsert_e_idempotente(db):
fills = [f for r in T.parse_cron_log(LOG_FINTO) for f in r.fills]
assert T.upsert_fills(db, fills) == 2
assert T.upsert_fills(db, fills) == 0 # secondo giro: nessun duplicato
assert db.execute("SELECT COUNT(*) c FROM fills").fetchone()["c"] == 2
def test_roundtrip_sono_derivati_non_accumulati(db):
T.upsert_fills(db, [_f("2026-01-01T00:00:00+00:00", "BTC", "buy", 1.0, 100.0),
_f("2026-01-02T00:00:00+00:00", "BTC", "sell", 1.0, 110.0)])
assert T.rebuild_roundtrips(db) == 1
assert T.rebuild_roundtrips(db) == 1 # ricalcolo, non append
assert db.execute("SELECT COUNT(*) c FROM roundtrips").fetchone()["c"] == 1
def test_equity_una_riga_per_istante(db):
assert T.upsert_equity(db, [("2026-01-01T00:00:00+00:00", 600.0, "x")]) == 1
assert T.upsert_equity(db, [("2026-01-01T00:00:00+00:00", 999.0, "x")]) == 0
assert db.execute("SELECT equity FROM equity").fetchone()["equity"] == 600.0
def test_stato_aperto_media_i_lotti(db):
T.upsert_fills(db, [_f("2026-01-01T00:00:00+00:00", "ETH", "buy", 1.0, 100.0),
_f("2026-01-02T00:00:00+00:00", "ETH", "buy", 1.0, 200.0)])
st = T.stato_aperto(db)
assert st["ETH"]["qty"] == pytest.approx(2.0)
assert st["ETH"]["prezzo_medio"] == pytest.approx(150.0)
# ---------------------------------------------------------------- regressione sulla SORGENTE
def test_l_esecutore_non_data_piu_i_fill_alla_barra_di_segnale():
"""Il difetto riparato il 2026-08-23: `ts_utc` era `pd.Timestamp(r['last_data'])`.
Se qualcuno lo rimette, questo test lo dice — il DB verrebbe ricostruito su date finte.
"""
src = (Path(__file__).resolve().parents[1] / "scripts" / "live" / "book_execute.py").read_text()
assert "ts_utc=str(pd.Timestamp(r['last_data']))" not in src
assert "bar_ts=str(pd.Timestamp(r['last_data']))" in src
assert "ts_utc=datetime.now(timezone.utc)" in src