Commit Graph

10 Commits

Author SHA1 Message Date
Adriano 7290900dc7 feat(cerbero): tools wrapper for Phase 1 indicator subset
Espone sma/rsi/atr/macd/realized_vol/funding_rate sopra CerberoClient
delegando a call_tool(exchange, tool, args).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 19:27:34 +02:00
Adriano 14b1b84a47 feat(cerbero): HTTP client with bearer + bot-tag + retry
Client minimale verso Cerbero MCP unified server con header
Authorization Bearer e X-Bot-Tag su ogni richiesta. Retry esponenziale
solo su ConnectionError (non su 4xx). 4xx/5xx -> RuntimeError.

Switch da httpx a requests per allineamento con libreria mock
`responses` (httpx richiederebbe respx). httpx resta in deps per usi
futuri. Aggiunto types-requests ai dev deps per mypy strict.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 19:25:00 +02:00
Adriano b61bbaf13c feat(metrics): Deflated Sharpe Ratio (Bailey & Lopez de Prado)
Aggiunge expected_max_sharpe e deflated_sharpe_ratio per correggere
multiple testing nella valutazione di strategie. Considera skewness,
kurtosis e numero di trial.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 19:21:35 +02:00
Adriano 2687ce7dd2 feat(metrics): Sharpe + max drawdown + total return
Metriche base per valutazione strategie: Sharpe annualizzato
(default 8760 periodi/anno per dati orari), max drawdown
percentuale dalla curva equity, total return cumulativo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 19:18:48 +02:00
Adriano 9301ab9051 feat(backtest): event-driven engine with 1-bar exec delay
Engine sincrono bar-per-bar con delay 1: segnale a t-1 esegue a open di t
per evitare lookahead. Position sizing 1 unit, fees su entry+exit,
mark-to-market su close, chiusura forzata posizione open a fine serie.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 19:15:05 +02:00
Adriano 36e05233d0 feat(backtest): Order/Position/Trade dataclasses with fees
Side StrEnum (long/short/flat), frozen dataclasses con calcolo
unrealized_pnl per Position e gross/fees/net_pnl per Trade
(fees in basis point, default 5bp). 4 test TDD passing,
ruff + mypy strict clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 19:11:27 +02:00
Adriano d30f981421 feat(data): expanding walk-forward splits
Aggiunge expanding_walk_forward e dataclass Split per generare fold
walk-forward con train che cresce e test sulla finestra successiva.
Rispetta min_train_days e ritorna lista vuota su fold troppo piccoli.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 19:08:43 +02:00
Adriano 116879400a fix(data): restore pagination early-break + update test count
Code review on b977c37 flagged: with dataset smaller than limit=1000
(typical Phase 1 case), the loop made an extra HTTP request that
returned duplicate rows. Restored `if len(rows) < limit: break`
after extending. Test assertion adjusted from 2 to 1 calls.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 19:06:50 +02:00
Adriano b977c371e5 feat(data): OHLCV loader via ccxt with parquet cache
Adjust .gitignore to keep src/multi_swarm/data/ tracked (only
top-level /data/ cache directory remains ignored).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 19:01:25 +02:00
Adriano b73416f482 feat(config): pydantic settings loader from .env
Aggiunge Settings (BaseSettings) che carica configurazione da
variabili d'ambiente / file .env, con validazione obbligatoria
dei segreti Cerbero testnet e OpenRouter.

Test:
- test_settings_loads_from_env: happy path via monkeypatch.setenv
- test_settings_requires_tokens: ValidationError quando token
  obbligatori mancano (forza _env_file=None per isolare il test
  da eventuale .env locale popolato).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 18:55:04 +02:00