2 Commits

Author SHA1 Message Date
Adriano Dal Pastro 1c0058ec3b feat(strategy): swap BTC paper strategy a 9cf506b8 (hardened-001 robust winner)
Sostituisce btc_fb63e851 (in produzione dal 13 maggio, net +$9.9k su 7y BTC,
Sharpe medio -0.20) con btc_9cf506b8, vincitore del run phase1-hardened-001
(K=50 G=15 7y, fitness-v2 con hard-kill su fees_eat_alpha + negative_net_pnl).

Performance comparate su 7y BTC continui:
- btc_fb63e851:   Net +$9,951  Sharpe medio -0.20  4/8 anni positivi
- btc_9cf506b8:   Net +$30,538 Sharpe medio +0.31  5/8 anni positivi
                  Best year 2021: +$18,938 (vs prod +$6,835)
                  Best Sharpe annuale: 2023 +1.27 (vs prod 2024 +1.16)
                  Zero adversarial findings su 7y continui.

Performance cross-asset (test su ETH 6.8y):
- btc_fb63e851 su ETH: -$120 (pseudo-flat, nessun segnale)
- btc_9cf506b8 su ETH: +$2,059 (4/7 anni positivi)
La strategia generalizza out-of-asset, indicatore di robustezza non-ETH-overfit.

DSL: physicist style, lookback 150 bar (~6 giorni). Triple-AND condition su
realized_vol + atr_pct + sma_pct per entry (long o short). Exit su sma_pct=0
o vol collasso (<0.1%). Selettivo: 502 trade in 7y = 1.4 trade/giorno medio.

btc_fb63e851 archiviato in strategies/archive/ per consultazione futura.
Il glob loader `btc_*.json` e' non-ricorsivo, quindi archive/ non viene
caricato automaticamente.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 13:21:37 +00:00
Adriano Dal Pastro 220e510d5e fix(orchestrator): escludi prompt_library dal config_dict JSON
PromptLibrary e' un frozen dataclass non JSON-serializable. Quando passata in
cfg.prompt_library e poi spread via **cfg.__dict__ in config_dict, faceva
fallire repo.create_run() con TypeError al primo run dopo refactor.

Fix: filtra cfg.__dict__ escludendo prompt_library, e salva separatamente la
lista degli stili (prompt_library_styles) per reproducibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 13:21:08 +00:00
3 changed files with 147 additions and 1 deletions
@@ -112,10 +112,16 @@ def run_phase1(
repo = Repository(cfg.db_path) repo = Repository(cfg.db_path)
repo.init_schema() repo.init_schema()
# Escludi prompt_library (PromptLibrary dataclass non e' JSON-serializable);
# salva solo i nomi degli stili per reproducibility.
config_dict = { config_dict = {
**cfg.__dict__, **{k: v for k, v in cfg.__dict__.items() if k != "prompt_library"},
"db_path": str(cfg.db_path), "db_path": str(cfg.db_path),
"model_tier": cfg.model_tier.value, "model_tier": cfg.model_tier.value,
"prompt_library_styles": (
list(cfg.prompt_library.cognitive_styles)
if cfg.prompt_library is not None else None
),
} }
run_id = repo.create_run(name=cfg.run_name, config=config_dict) run_id = repo.create_run(name=cfg.run_name, config=config_dict)
@@ -0,0 +1,140 @@
{
"rules": [
{
"condition": {
"op": "and",
"args": [
{
"op": "gt",
"args": [
{
"kind": "indicator",
"name": "realized_vol",
"params": [150]
},
{
"kind": "literal",
"value": 0.01
}
]
},
{
"op": "lt",
"args": [
{
"kind": "indicator",
"name": "atr_pct",
"params": [150]
},
{
"kind": "literal",
"value": 0.02
}
]
},
{
"op": "gt",
"args": [
{
"kind": "indicator",
"name": "sma_pct",
"params": [150]
},
{
"kind": "literal",
"value": 0.05
}
]
}
]
},
"action": "entry-long"
},
{
"condition": {
"op": "and",
"args": [
{
"op": "lt",
"args": [
{
"kind": "indicator",
"name": "realized_vol",
"params": [150]
},
{
"kind": "literal",
"value": 0.005
}
]
},
{
"op": "gt",
"args": [
{
"kind": "indicator",
"name": "atr_pct",
"params": [150]
},
{
"kind": "literal",
"value": 0.03
}
]
},
{
"op": "lt",
"args": [
{
"kind": "indicator",
"name": "sma_pct",
"params": [150]
},
{
"kind": "literal",
"value": -0.05
}
]
}
]
},
"action": "entry-short"
},
{
"condition": {
"op": "or",
"args": [
{
"op": "eq",
"args": [
{
"kind": "indicator",
"name": "sma_pct",
"params": [150]
},
{
"kind": "literal",
"value": 0.0
}
]
},
{
"op": "lt",
"args": [
{
"kind": "indicator",
"name": "realized_vol",
"params": [150]
},
{
"kind": "literal",
"value": 0.001
}
]
}
]
},
"action": "exit"
}
]
}