chore(reset): v2.0.0 — storico certificato Deribit mainnet, ripartenza pulita
Reset del progetto su fondamenta verificate dopo la scoperta che l'intera libreria "validata OOS" era artefatto di feed contaminato (print fantasma del feed Cerbero TESTNET + storico Binance/USDT). - Storico ricostruito da Deribit MAINNET (ccxt pubblico, tokenless) e CERTIFICATO (certify_feed.py): BTC/ETH puliti su TUTTA la storia (mediana 2-6 bps vs Coinbase USD), integrita' OHLC + coerenza resample (maxΔ 0.00) + cross-venue OK. Alt esclusi (illiquidi/divergenti: LTC/DOGE 50-82% barre flat; XRP/BNB non certificabili). - Verdetto sul feed pulito: FADE / PAIRS / XS01 / TSM01 morti (ogni portafoglio Sharpe -2.3..-3.0, DD ~40%); solo SH01 e frammenti HONEST con segnale residuo, da ri-validare in isolamento. - Cleanup "restart pulito": strategie, stack live (src/live, src/portfolio, runner/executor, yml, docker), ~100 script ricerca/gate, waste/games/ portfolios, dati non certificati + cache e 60+ diari -> archiviati in Old/ (preservati, non cancellati). Diario consolidato in un unico documento. - Skeleton ricerca tenuto: Strategy ABC + indicatori + src/fractal + src/backtest/engine + load_data; tool dati certificati (rebuild_history, certify_feed, audit_feed, multi_source_check). - Universo dati ATTIVO: solo BTC/ETH (5m/15m/1h); guardrail fisico (load_data su alt -> FileNotFoundError). Esecuzione DISABILITATA, conto flat. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
"""Mostra lo stato del paper trader."""
|
||||
from __future__ import annotations
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from src.live.cerbero_client import CerberoClient
|
||||
|
||||
LOG_DIR = Path("data/paper_trades")
|
||||
|
||||
print("=" * 50)
|
||||
print(" PAPER TRADER STATUS")
|
||||
print("=" * 50)
|
||||
|
||||
# Status file
|
||||
status_path = LOG_DIR / "status.json"
|
||||
if status_path.exists():
|
||||
with open(status_path) as f:
|
||||
status = json.load(f)
|
||||
print(f"\n In posizione: {status['in_position']}")
|
||||
if status["in_position"]:
|
||||
print(f" Direzione: {status['direction']}")
|
||||
print(f" Entry price: {status['entry_price']}")
|
||||
print(f" Entry time: {status['entry_time']}")
|
||||
print(f" Barre tenute: {status['bars_held']}")
|
||||
print(f" Ultimo update: {status['last_update']}")
|
||||
else:
|
||||
print("\n Nessun file di stato trovato.")
|
||||
|
||||
# Account
|
||||
print("\n--- ACCOUNT DERIBIT TESTNET ---")
|
||||
c = CerberoClient()
|
||||
try:
|
||||
acc = c.get_account_summary("USDC")
|
||||
print(f" Equity: ${acc['equity']:,.2f}")
|
||||
print(f" Balance: ${acc['balance']:,.2f}")
|
||||
print(f" PnL: ${acc['total_pnl']:,.2f}")
|
||||
except Exception as e:
|
||||
print(f" Errore: {e}")
|
||||
|
||||
# Posizioni
|
||||
try:
|
||||
pos = c.get_positions("USDC")
|
||||
print(f"\n Posizioni aperte: {len(pos)}")
|
||||
for p in pos:
|
||||
print(f" {p.get('instrument','?')}: {p.get('size',0)} {p.get('direction','?')} @ ${p.get('avg_price',0)}")
|
||||
except Exception as e:
|
||||
print(f" Errore: {e}")
|
||||
|
||||
# Ultimi log
|
||||
print("\n--- ULTIMI LOG ---")
|
||||
log_files = sorted(LOG_DIR.glob("trades_*.jsonl"))
|
||||
if log_files:
|
||||
with open(log_files[-1]) as f:
|
||||
lines = f.readlines()
|
||||
for line in lines[-10:]:
|
||||
entry = json.loads(line)
|
||||
print(f" [{entry['timestamp'][:19]}] {entry['event']}")
|
||||
else:
|
||||
print(" Nessun log trovato.")
|
||||
|
||||
# Statistiche trade
|
||||
all_trades = []
|
||||
for lf in log_files:
|
||||
with open(lf) as f:
|
||||
for line in f:
|
||||
entry = json.loads(line)
|
||||
if entry["event"] == "CLOSED":
|
||||
all_trades.append(entry)
|
||||
|
||||
if all_trades:
|
||||
wins = sum(1 for t in all_trades if t.get("pnl_pct", 0) > 0)
|
||||
total = len(all_trades)
|
||||
total_pnl = sum(t.get("pnl_pct", 0) for t in all_trades)
|
||||
print(f"\n--- STATISTICHE ---")
|
||||
print(f" Trade chiusi: {total}")
|
||||
print(f" Win rate: {wins/total*100:.0f}%")
|
||||
print(f" PnL totale: {total_pnl:.2f}%")
|
||||
Reference in New Issue
Block a user