sleeves+edge_watch: pesi derivati da book (import locale), titolo kill corretto (#35 B12)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -150,6 +150,27 @@ def test_weights_match_backtest_sleeves():
|
||||
assert abs((W_TP01 + W_SKH) - 1.0) < 1e-12
|
||||
|
||||
|
||||
def test_deribit_book_sleeves_deriva_i_pesi_da_book_non_li_ridichiara():
|
||||
"""#35 B12 — P1: stesso pattern di test_r0909_libro_nei_crolli.test_P1_i_pesi_sono_QUELLI_del_book_live_non_una_copia.
|
||||
`test_weights_match_backtest_sleeves` sopra passerebbe anche con due letterali per coincidenza
|
||||
di valore (0.75/0.25 riscritti a mano): qui si verifica l'IDENTITA' con B.W_TP01/B.W_SKH e
|
||||
che il letterale non sia piu' nella fonte di `deribit_book_sleeves`."""
|
||||
import inspect
|
||||
import re
|
||||
|
||||
import src.live.book as B
|
||||
from src.portfolio.sleeves import deribit_book_sleeves
|
||||
|
||||
pesi = {s.name.split("_")[0]: s.weight for s in deribit_book_sleeves()}
|
||||
assert pesi["TP01"] is B.W_TP01 or pesi["TP01"] == B.W_TP01
|
||||
assert pesi["SKH01"] is B.W_SKH or pesi["SKH01"] == B.W_SKH
|
||||
|
||||
src = inspect.getsource(deribit_book_sleeves)
|
||||
assert "from src.live import book" in src, "i pesi devono derivare da src.live.book (P1)"
|
||||
assert not re.search(r"weight\s*=\s*0\.75", src), "peso TP01 ancora cablato"
|
||||
assert not re.search(r"weight\s*=\s*0\.25", src), "peso SKH01 ancora cablato"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Costruzione ordine: side, reduce_only, flip, close, soglia minima.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user