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

@@ -581,7 +581,12 @@ class MinimalCryptoLOBCWM:
if cumulative_usd >= new_fill_price * new_fill_qty:
break
if cumulative_levels > 0:
expected_slippage_bps = cumulative_levels * 0.1
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(
state.venue.symbol, cumulative_levels,
new_fill_price * new_fill_qty, total_book_usd,
)
is_maker_fill = (our_action.order_type and our_action.order_type.value == "LIMIT") or our_action.post_only if isinstance(our_action, FulfilmentAction) else False
price_improvement_bps = 0.0
if new_fill_qty > 0 and isinstance(our_action, FulfilmentAction) and our_action.post_only and our_action.side: