Phase 1: core algorithms

Implementa i sette algoritmi puri di docs/03-algorithms.md con
disciplina TDD: 112 test, copertura statement+branch al 100% su
core/ e config/, mypy --strict pulito, ruff pulito.

Moduli:
- config/schema.py: StrategyConfig Pydantic v2 con validatori di
  consistenza (kelly, delta, OTM, spread width, profit/stop).
- core/types.py: OptionQuote e OptionLeg condivisi.
- core/entry_validator.py: validate_entry (accumula motivi) e
  compute_bias (bull_put/bear_call/iron_condor/None).
- core/liquidity_gate.py: check OI/volume/spread/depth + slippage
  stimato in % del credito.
- core/sizing_engine.py: Quarter Kelly con cap 200/1000 EUR e
  bande DVOL.
- core/combo_builder.py: select_strikes (DTE/OTM/delta/width/credit)
  e build (ComboProposal con credit/max_loss/breakeven).
- core/greeks_aggregator.py: somma firmata BUY/SELL, theta in USD.
- core/exit_decision.py: 6 trigger ordinati con eccezione skip-time
  vicino a profit (mark in (50%,70%] credito).
- core/kelly_recalibration.py: full/quarter Kelly, confidence per
  sample size, blend medio in fascia 30-99 trade.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-27 10:14:06 +02:00
parent 881bc8a1bf
commit fbb7753cc6
20 changed files with 3090 additions and 1 deletions
+5 -1
View File
@@ -86,10 +86,14 @@ select = [
ignore = [
"PLR0913", # too many arguments (we accept config-heavy functions)
"PLR2004", # magic value (we have many domain constants in tests)
"PLR0911", # too many return statements (rule engines have many early returns)
"RUF001", # ambiguous unicode in strings (we use math symbols × ≤ ≥)
"RUF002", # ambiguous unicode in docstrings
"RUF003", # ambiguous unicode in comments
]
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["PLR2004", "ARG", "S101"]
"tests/**" = ["PLR2004", "ARG", "S101", "ERA001", "B017"]
[tool.ruff.format]
quote-style = "double"