Generalizes the Backtest page beyond the Bybit-only venue: bybit_4edge/bybit_4edge_levered keep reading the precomputed bybit_sleeve_ret table; the IBKR paper strategies (multistrat, vrp) now read their own precomputed recompute-replay curve from a new sim_curve_ret table, written nightly by _persist_track_backtest_ref from the SAME rows the reconciliation-gate ref is derived from. New sim_curves.sim_returns_for dispatches on registry_backtest_kind; app.py wires an _ibkr_measured_context render path (reusing the existing pure simulate_naive_eqwt engine) alongside the unchanged Bybit measured-cost path, with plain-language pill labels for the two IBKR books. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
909 B
Python
26 lines
909 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", "vrp")
|