feat: HFT infrastructure — tick backtest runner, VPIN-gated A-S maker, WQI predictor, queue-aware fills
- backtests/tick_runner.py: TickBacktestRunner replays stored Parquet L2/trade events through sim/engine.py with queue position modeling, producing PnL breakdowns, equity curves, VPIN curves, and QuantVerdict significance reports - VPINGatedASMaker: VPIN-toxicity-gated A-S market maker with inventory skew and dynamic spread widening; blocks quoting when VPIN >= alarm threshold - sim/engine.py: Added SimConfig.from_fee_tier() factory — constructs sim config from Hyperliquid fee tier (VIP + staking) - sim/fills.py: Added QueueAwareFillModel — realistic queue-priority fill simulation replacing random fills in paper trading - strategies/wqi_predictor.py: WQI z-score directional strategy with adverse selection gating, timeout exit, stop-loss, and take-profit - cli.py: Added 'tick', 'markout' analysis, and 'discover' signal-discovery commands for end-to-end tick-level HFT research pipeline 301 tests passing (23 new).
This commit is contained in:
+23
-2
@@ -60,10 +60,31 @@ class SimConfig:
|
||||
scenario: ScenarioConfig = field(default_factory=ScenarioConfig)
|
||||
|
||||
# Simulation behavior
|
||||
cancel_after_ms: float = 5000.0 # cancel and re-quote every N ms
|
||||
quote_refresh_ms: float = 2000.0 # refresh quotes every N ms
|
||||
cancel_after_ms: float = 5000.0
|
||||
quote_refresh_ms: float = 2000.0
|
||||
seed: int | None = None
|
||||
|
||||
@classmethod
|
||||
def from_fee_tier(
|
||||
cls,
|
||||
vip_tier: int = 0,
|
||||
staking_tier: str = "none",
|
||||
maker_rebate_tier: int = 0,
|
||||
**kwargs,
|
||||
) -> "SimConfig":
|
||||
from config.fee_tiers import get_perp_fees, PERPS_TIERS, STAKING_TIERS
|
||||
|
||||
maker_fee = get_perp_fees(vip_tier, staking_tier, "maker", maker_rebate_tier)
|
||||
taker_fee = get_perp_fees(vip_tier, staking_tier, "taker", maker_rebate_tier)
|
||||
tier_name = PERPS_TIERS[vip_tier]["name"]
|
||||
staking_name = STAKING_TIERS.get(staking_tier, STAKING_TIERS["none"])["name"]
|
||||
|
||||
return cls(
|
||||
maker_fee_pct=maker_fee,
|
||||
taker_fee_pct=taker_fee,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
class SimulationEngine:
|
||||
"""Event-driven market-making simulator.
|
||||
|
||||
Reference in New Issue
Block a user