import json, sys
from eng import *
V = [
 (1, "baseline v3 (30/15, BTC100+majors, half at hot)", {}),
 (2, "no half (just 15d low exit)", dict(half=None)),
 (3, "buy 1 day late", dict(delay=1)),
 (4, "buy 2 days late", dict(delay=2)),
 (5, "buy 3 days late", dict(delay=3)),
 (6, "buy 5 days late", dict(delay=5)),
 (7, "buy 8 days late", dict(delay=8)),
 (8, "buy 13 days late", dict(delay=13)),
 (9, "only if <=10% above breakout level", dict(ext_cap=0.10)),
 (10, "only if <=20% above breakout level", dict(ext_cap=0.20)),
 (11, "half at day 8 (breakout clock)", dict(half='day', half_day=8)),
 (12, "half at first of hot or day 8", dict(half='first', half_day=8)),
 (13, "all out day 13", dict(half=None, take_all_day=13)),
 (14, "hold 5 days only", dict(half=None, exit_rule='hold5')),
 (15, "half hot, rest 15d low, max 55d", dict(max_days=55)),
 (16, "exit at 10d low", dict(sell_low=10)),
 (17, "exit at 20d low", dict(sell_low=20)),
 (18, "half hot, then trail 7d low", dict(trail_after_half=7)),
 (19, "half at first of hot/day8, then trail 7d low", dict(half='first', half_day=8, trail_after_half=7)),
 (20, "gate BTC > 50d instead of 100d", dict(btc='50')),
 (21, "gate BTC > 20d", dict(btc='20')),
 (22, "BTC gate only, no majors gate", dict(majors=False)),
 (23, "no market gate at all", dict(majors=False, btc=None)),
 (24, "skip if basket +100% in 30d (froth)", dict(froth_double=2.0)),
 (25, "skip if basket +60% in 30d (froth)", dict(froth_double=1.6)),
 (26, "skip Solana if SOL/BTC +20% in 4w", dict(solbtc_froth=0.20)),
 (27, "need 25% of other baskets on", dict(breadth=0.25)),
 (28, "need 50% of other baskets on", dict(breadth=0.50)),
 (29, "cooldown 5 days after a sell", dict(cooldown=5)),
 (30, "need 2 closes above 30d high", dict(two_closes=True)),
 (31, "hot = z>=2.5", dict(hot_z=2.5)),
 (32, "2% costs", dict(cost=0.02)),
 (33, "20/10 windows", dict(nin=20, nout=10)),
 (34, "50/20 windows", dict(nin=50, nout=20)),
]
R = {}
for i, nm, kw in V:
    r = evaluate(**kw); R[i] = dict(name=nm, kw=kw, **{k: v for k, v in r.items() if k != 'trades'})
    print("%2d %s" % (i, line(nm, r)), flush=True)
json.dump(R, open('res_a.json', 'w'))
