Files
fxhnt/tests/unit/test_sim_curves.py
jgrusewski 713424a89d feat(fund): multistrat_levered — observe-only levered shadow of the ETF book + financing sensitivity band
The multistrat ETF book is an UNDER-levered risk-parity book: it runs at ~5.7%
vol vs its own 10% target because leverage is capped at 1x (MAXLEV=1.0), leaving
return on the table. Add a return-defined observe-only shadow (cf.
bybit_4edge_levered) that levers the SAME series to the 10% vol target minus the
HONEST financing drag on the borrowed leg.

- LeveredShadowStrategy (paper_strategies.py): L = min(max_lev, target_vol/vol),
  floored at 1x; levered_ret = L·r − (L−1)·financing/252. Never executed.
- multistrat_levered_nav asset (deps=multistrat_nav) publishes its forward track
  + basis-matched backtest ref like the base; registered in the nightly job.
- multistrat_levered registry entry + SIM_BOOKS (Backtest switcher).
- financing_bps=530 GROUNDED in IBKR's real USD schedule (verified 2026-07-18:
  Fed funds 3.63% + Pro tiered spread → 5.83% <$100k / ~5.3% $100k-1M).
- leverage_financing_sensitivity() + a cockpit BAND on the levered book's
  Backtest view: levered return/vol/Sharpe across 1..6.83% + the break-even
  (= the book's 7.7% return), so the verdict is never hostage to one rate.

Honest finding it surfaces: at any realistic IBKR retail rate (~5-7%) levering
this modest-return book LOWERS risk-adjusted return (Sharpe 1.35 -> ~0.9); it
only pays at institutional financing (~1-3%). The financing drag is what makes
the shadow honest (without it, free leverage would look like 13.5%/Sharpe 1.35).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 11:15:55 +02:00

26 lines
931 B
Python

from fxhnt.application.sim_curves import SIM_BOOKS, sim_returns_for
def _bybit(): return {"tstrend": {0: 0.0, 1: 0.01}}
def _ibkr(book): return {book: {0: 0.0, 1: 0.02}}
def test_bybit_book_reads_bybit_sleeve_returns():
out = sim_returns_for("bybit_4edge", bybit_returns=_bybit, ibkr_curve=_ibkr)
assert out == {"tstrend": {0: 0.0, 1: 0.01}}
def test_ibkr_recompute_replay_book_reads_ibkr_curve():
out = sim_returns_for("multistrat", bybit_returns=_bybit, ibkr_curve=_ibkr)
assert out == {"multistrat": {0: 0.0, 1: 0.02}}
def test_vrp_recompute_replay_book_reads_ibkr_curve():
out = sim_returns_for("vrp", bybit_returns=_bybit, ibkr_curve=_ibkr)
assert out == {"vrp": {0: 0.0, 1: 0.02}}
def test_sim_books_includes_ibkr():
assert "multistrat" in SIM_BOOKS and "bybit_4edge" in SIM_BOOKS
assert SIM_BOOKS == ("bybit_4edge", "bybit_4edge_levered", "multistrat", "multistrat_levered", "vrp")