Files
Adriano Dal Pastro 5ac4e16af8 research(alt): sweep 104 strategie alternative su Deribit (153 agenti) + marginal scorer
Ondata di ricerca onesta a largo spettro su BTC/ETH+DVOL certificati: 104 ipotesi
distinte (11 famiglie), un agente-finder per ipotesi, verifica avversariale a 3
scettici sui promettenti, sintesi (153 agenti totali). Esito: NIENTE di nuovo regge
-> conferma del soffitto strutturale ~1.3 BTC/ETH-direzionale; lo stack
TP01+XS01+VRP01 resta imbattuto.

- altlib.py: harness condiviso vettoriale leak-free (eval_weights/study_weights,
  fee-sweep, both-asset + hold-out 2025+). Riproduce i numeri canonici di TP01.
- MARGINAL SCORER (study_marginal/marginal_vs_tp01): Sharpe INCREMENTALE vs baseline
  TP01 (corr, blend uplift OOS, alpha residua) + jackknife OOS (clean-year +
  drop-best-month). earns_slot = abs!=FAIL & ADDS & robust_oos. Smaschera gli overlay
  su TSMOM con PASS assoluti fasulli (CMB04, VOL11, ...) e il falso positivo KAMA
  (ADDS ma muore al jackknife).
- runs/*.py (104) script riproducibili per ipotesi; wf_altstrat.js workflow.
- Verdetto: 0 candidati deployabili; 2 LEAD fragili (VOL08, STA05_LS) da forward-monitor.
- test_marginal_scorer.py blocca baseline + invarianti. Suite: 32 verde.

Diario: docs/diary/2026-06-20-alt-strategies-100agent-sweep.md

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 19:50:39 +00:00

63 lines
2.0 KiB
Python

"""MIC01 — Three-bar momentum (micro-continuation).
HYPOTHESIS: 3 consecutive higher closes -> enter long at the 3rd close,
exit after k bars or on a lower close. Continuation test.
Grid: k (exit after k bars if no stop) in {3, 5, 8, 10}
Style: study_signals (discrete entry/exit, 1d only).
Causality: decision at close[i] uses only close[i-2], close[i-1], close[i].
Entry fills at close[i] (the 3rd consecutive higher close).
Exit: on next bar where close < prior close, OR after max_bars.
"""
import sys
sys.path.insert(0, "/opt/docker/PythagorasGoal/scripts/research/alt")
import altlib as al
import numpy as np
def make_entries(max_bars: int):
"""Return entries_fn for a given max_bars parameter."""
def entries_fn(df):
c = df["close"].values
n = len(c)
entries = [None] * n
for i in range(2, n):
# 3 consecutive higher closes: close[i] > close[i-1] > close[i-2]
if c[i] > c[i-1] and c[i-1] > c[i-2]:
entries[i] = {
"dir": +1,
"tp": None,
"sl": None,
"max_bars": max_bars,
}
return entries
return entries_fn
# Small internal grid: 4 param sets, 1 TF, 2 assets = 8 backtests total
# (within the <=6 total limit would be 3 configs; using 4 is borderline, reduce to 3 if slow)
GRID = [3, 5, 8, 12]
best_rep = None
best_score = -999.0
for k in GRID:
rep = al.study_signals(
f"MIC01-k{k}",
make_entries(max_bars=k),
tfs=("1d",),
)
v = rep["verdict"]
# Score = min hold-out Sharpe across assets (conservative)
score = v.get("best_holdout_sharpe", -999.0)
print(f"k={k:2d}: grade={v['grade']} minFull={v.get('best_full_sharpe'):+.3f} minHold={v.get('best_holdout_sharpe'):+.3f}")
if score > best_score:
best_score = score
best_rep = rep
best_k = k
print(f"\nBest config: k={best_k}")
print(al.fmt(best_rep))
print("JSON:", al.as_json(best_rep))