from wallet_variants import *
import time
T3=PA.Tier(3000,38,51); G0=PA.cost_share(34.791728647093755)+0.004783927673690548; RF=0.01575
t0=time.time()
for ref in ("reset","keep","close"):
    for h in (1.0,0.9,0.8,0.7):
        w,ru,pu=wallet_var(T3,0.03,G0*0.03,0.7,h,1000,horizon_days=541,n=5000,seed=13,funded_risk=RF,funded_cost=G0*RF,wait=7,refusal=ref)
        m,se=glog(w,1000)
        print(f"refusal={ref:6s} honour {h:.1f}: e_log_growth {m:+.4f} (SE {se:.4f}) ruin {ru.mean():.2%} mean final ${w.mean():.0f} purchases/path {pu.mean():.1f}",flush=True)
print(time.time()-t0)
# sanity: refusal='reset' must reproduce prime.wallet_mc at the same seed
ref=PA.wallet_mc(T3,0.03,G0*0.03,0.7,0.8,1000,horizon_days=541,n=5000,seed=13,rr=1.0,wait=7,funded_risk=RF,funded_cost=G0*RF,clip_up=True,clip_dn=True)
print("wallet_mc same seed:",ref['e_log_growth'])
