malkhut: urgency-driven maker/taker + calibrated slippage + chase + docs
This commit is contained in:
@@ -394,3 +394,44 @@ reward = w_fill_probability * fill_value_score ← PRIMARY
|
||||
PerformanceMatrix stores `avg_fill_rate`, `avg_slippage_bps`, `avg_price_improvement_bps`,
|
||||
`avg_fill_value_score` per (regime, strategy, venue) — enabling:
|
||||
"Which strategy achieves the best fill quality in regime X on venue Y?"
|
||||
|
||||
## Urgency-Driven Maker/Taker Decision
|
||||
|
||||
Two CMA-ES optimizable parameters control the maker/taker boundary:
|
||||
- `urgency_taker_threshold` (default 0.65): urgency level to switch from passive to aggressive
|
||||
- `urgency_taker_penalty_bps` (default 2.0): penalty for taker fills at low urgency
|
||||
|
||||
Action menu generates three urgency bands:
|
||||
1. urgency < threshold×0.5: passive only (no CROSS_SPREAD actions)
|
||||
2. threshold×0.5 < urgency < threshold: IOC partial taker (small sizes)
|
||||
3. urgency > threshold: full taker (aggressive crossing)
|
||||
|
||||
Reward function adds urgency penalty:
|
||||
```python
|
||||
if is_cross and urgency < threshold:
|
||||
penalty = urgency_taker_penalty_bps * (1 - urgency / threshold)
|
||||
fill_quality_reward -= penalty
|
||||
```
|
||||
|
||||
The CMA-ES learns the optimal threshold per (asset, regime, venue).
|
||||
|
||||
## Calibrated Slippage
|
||||
|
||||
SlippageCalibration uses Flight7 VST + mainnet anchors:
|
||||
- **Deep book** (BTC/ETH): `alpha * levels + beta * depth_ratio` (walks book)
|
||||
- **Thin book** (alts): `intercept + adverse_selection` (fills entire book in 1-2 levels)
|
||||
|
||||
Switch: `book_depth_usd < thin_book_threshold_usd → thin mode`
|
||||
|
||||
Per-asset configurable, per-run overridable via `SlippageRegistry.override()`.
|
||||
|
||||
## Chase Mechanics
|
||||
|
||||
CHASE in DSL: cancel → wait_to_retry_ms → retry at new offset.
|
||||
Parameters in FulfilmentPolicyParams:
|
||||
- `wait_to_retry_ms` (0-2000): delay before re-quoting
|
||||
- `chase_enabled`: enable chase-follow behavior
|
||||
- `chase_offset_ticks` (0-10): ticks from target price to chase
|
||||
- `chase_max_retries` (0-5): max cancel-retry cycles
|
||||
|
||||
All three parameters are in the CMA-ES optimization cycle.
|
||||
|
||||
Reference in New Issue
Block a user