14522262e6
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>
40 lines
1.8 KiB
Python
40 lines
1.8 KiB
Python
"""T5: integrazione worker honest/TSM01 nel PortfolioRunner."""
|
|
from src.portfolio.runner import build_worker_for, _STRAT_MODULE, _MULTI_KINDS
|
|
from src.portfolio.base import SleeveSpec
|
|
from src.live.basket_trend_worker import BasketTrendWorker
|
|
from src.live.rotation_worker import RotationWorker
|
|
from src.live.tsmom_worker import TsmomWorker
|
|
from src.live.strategy_worker import StrategyWorker
|
|
from scripts.portfolios._defs import PORTFOLIOS
|
|
|
|
|
|
def test_build_basket_worker(tmp_path):
|
|
spec = SleeveSpec(kind="basket", name="TR01", sid="TR01_basket",
|
|
params={"universe": ["BNB", "BTC"], "tf": "4h"})
|
|
w = build_worker_for(spec, alloc_capital=120.0, leverage=2.0, data_dir=tmp_path)
|
|
assert isinstance(w, BasketTrendWorker) and w.capital == 120.0
|
|
|
|
|
|
def test_build_rotation_and_tsmom(tmp_path):
|
|
rot = SleeveSpec(kind="rotation", name="ROT02", sid="ROT02_rot",
|
|
params={"universe": ["BTC", "ETH"], "tf": "1d", "top_k": 1, "gross": 0.45})
|
|
tsm = SleeveSpec(kind="tsmom", name="TSM01", sid="TSM01",
|
|
params={"universe": ["BTC", "ETH"], "tf": "1d", "gross": 0.30})
|
|
wr = build_worker_for(rot, 100.0, 2.0, data_dir=tmp_path)
|
|
wt = build_worker_for(tsm, 100.0, 2.0, data_dir=tmp_path)
|
|
assert isinstance(wr, RotationWorker) and wr.capital == 100.0
|
|
assert isinstance(wt, TsmomWorker) and wt.capital == 100.0
|
|
|
|
|
|
def test_dip01_builds_as_strategy_worker(tmp_path):
|
|
spec = SleeveSpec(kind="single", name="DIP01", sid="DIP01_BTC", asset="BTC")
|
|
w = build_worker_for(spec, 80.0, 2.0, data_dir=tmp_path)
|
|
assert isinstance(w, StrategyWorker) and w.capital == 80.0
|
|
|
|
|
|
def test_port06_has_no_unsupported_sleeves():
|
|
p = PORTFOLIOS["PORT06"]
|
|
unsupported = [s.sid for s in p.sleeves
|
|
if not (s.kind in ("pairs",) + _MULTI_KINDS or s.name in _STRAT_MODULE)]
|
|
assert unsupported == []
|