Commit Graph

6 Commits

Author SHA1 Message Date
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
Adriano 362ffb33a8 chore: project skeleton with uv + pyproject + deps
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 18:49:27 +02:00