malkhut: 3.5H instrumented E2E + calibrated slippage + conditional slippage

This commit is contained in:
Codex
2026-07-15 19:32:46 +02:00
parent c03d914e7a
commit 5c4ccdb1de
4 changed files with 668 additions and 2 deletions

View File

@@ -503,7 +503,13 @@ class HftBacktestCWM:
if cumulative_usd >= new_fill_price * new_fill_qty:
break
if cumulative_levels > 0:
expected_slippage_bps = cumulative_levels * 0.1 # ~0.1 bps per level consumed
# Calibrated slippage: per-asset model from VST data
from malkhut.training.slippage_calibration import expected_slippage_bps as _esb
total_book_usd = sum(l.price * l.qty for l in (book_depth or ()))
expected_slippage_bps = _esb(
prev_state.venue.symbol, cumulative_levels,
new_fill_price * new_fill_qty, total_book_usd,
)
# Price improvement: how much better than best bid/ask?
price_improvement_bps = 0.0