malkhut: urgency-driven maker/taker + calibrated slippage + chase + docs

This commit is contained in:
Codex
2026-07-17 10:16:55 +02:00
parent 5c4ccdb1de
commit 8857daedfa
9 changed files with 335 additions and 145 deletions

View File

@@ -543,6 +543,51 @@ The CMA-ES optimizer now receives fill quality metrics in each `EpisodeResult`:
The CMA-ES objective is: maximize fill quality (primary) while maintaining positive PnL.
#### Urgency-Driven Maker/Taker Decision
The system learns WHEN to use maker (passive) vs taker (aggressive) as a function of urgency:
| Urgency | Behavior | Penalty |
|---------|----------|---------|
| 0.0 – 0.3 | Passive only (maker). No taker actions generated. | — |
| 0.3 – 0.65 | IOC partial taker allowed. Small sizes, partial fills. | Low |
| 0.65 – 1.0 | Full taker allowed. Aggressive crossing at full size. | None |
Two CMA-ES optimizable parameters:
- `urgency_taker_threshold` (default 0.65): crosses from passive to aggressive
- `urgency_taker_penalty_bps` (default 2.0): penalty for taker at low urgency
The system learns: "For ADAUSDT in stress regime, threshold=0.4 (thin book → try maker,
but resort to taker when liquidity appears). For BTCUSDT in normal regime, threshold=0.8
(deep book → maker always works)."
#### Calibrated Slippage (Flight7 VST + Mainnet Anchors)
Slippage model per-asset, configurable, overridable per-run:
| Book Type | Model | Assets |
|-----------|-------|--------|
| **Deep book** | `slippage = alpha * levels + beta * depth_ratio` | BTC, ETH, BNB |
| **Thin book** | `slippage = intercept + adverse_selection` | DOGE, ADA, UNI, AAVE, ATOM |
Switch: `if book_depth_usd < thin_book_threshold_usd → thin mode`
Fable's Flight7 calibration anchors (testnet + mainnet):
- Majors: BTC ~0.1 bps, ETH ~0.4 bps (testnet ≈ mainnet)
- Liquid alts: 3-6 bps testnet, 10-30 bps mainnet (3-6× gap)
- Thin alts: 14-25 bps testnet, ~140 bps round-trip mainnet
#### Chase Mechanics
Cancel → wait → retry with configurable parameters (CMA-ES optimizable):
- `wait_to_retry_ms`: delay before re-quoting after cancel (0-2000ms)
- `chase_enabled`: enable chase-follow behavior
- `chase_offset_ticks`: ticks from target price to chase (0-10)
- `chase_max_retries`: max cancel-retry cycles (0-5)
CHASE in the DSL places a limit order at target offset with TTL=wait_to_retry_ms.
If not filled, the order expires and next step re-places at a new offset.
### Performance Benchmarks
| Metric | Value |