Microstructure Models
Exchange-Accurate Cadence Simulation
Section titled “Exchange-Accurate Cadence Simulation”Unlike generic synthetic data generators that emit perfect metronome ticks, The Aleatoric Engine replicates real exchange behavior.
Rate Limit Simulation
Section titled “Rate Limit Simulation”market = HyperSynthReactor( symbol="SOL", book_update_interval_ms=100, # Match Binance 100ms snapshot rate trade_intensity_base=2.0, # ~2 trades/sec baseline)Burst Mode
Section titled “Burst Mode”Simulate exchange message avalanches during high volatility:
config = SimulationManifest( burst_probability=0.05, # 5% chance of entering burst burst_intensity_factor=10.0, # 10x message rate during burst)During a liquidation cascade, message rates spike 10-100x. The engine captures this.
Staleness Simulation
Section titled “Staleness Simulation”Network jitter and exchange processing delays:
config = SimulationManifest( staleness_ms=50.0, # Mean 50ms lag with log-normal distribution)Includes:
- Log-normal jitter distribution (realistic network behavior)
- Occasional massive lag spikes (0.5% probability of 100-1000ms delays)
- Separate
timestamp_ms(exchange time) andcapture_time_ms(receive time)
L2/L3 Order Book Behavior
Section titled “L2/L3 Order Book Behavior”Order Book Replenishment
Section titled “Order Book Replenishment”Liquidity providers react to aggressive flow:
market = HyperSynthReactor( adverse_selection_strength=0.15, # 15% depth depletion impact_decay_halflife_ms=5000.0, # 5s recovery)Queue Dynamics
Section titled “Queue Dynamics”- Exponential depth profile: Size decreases exponentially away from best bid/ask
- Volatility-dependent liquidity withdrawal: Higher vol → lower depth
- Toxicity-aware spread widening: Informed flow detection → spreads widen
spread_vol_sensitivity=0.15, # Volatility impactspread_toxicity_sensitivity=0.25, # Informed flow impactBook Shape Distributions
Section titled “Book Shape Distributions”Real orderbooks don’t have uniform depth. The engine models:
- Power-law depth decay (
depth_decay_rate=0.85) - Volume-weighted microprice calculation
- Realistic bid/ask imbalances
Trade Size Heteroskedasticity
Section titled “Trade Size Heteroskedasticity”trade_size_alpha=2.5, # Pareto exponent (lower = fatter tail)min_trade_size=0.1,max_trade_size=50.0,Result: Many small trades (~0.1-1.0 size), occasional whale trades (10-50 size).
Funding Rate Physics
Section titled “Funding Rate Physics”Exchange-Specific Models
Section titled “Exchange-Specific Models”The engine models the ACTUAL implementation of each exchange:
| Exchange | Interval | Formula | Unique Features |
|---|---|---|---|
| Binance | 8h | Premium + Interest Rate | Soft/hard caps (±0.75%/±2%), damping |
| HyperLiquid | 8h | Premium × Velocity | Trend amplification (0.3x-2.5x), ±4% cap |
| OKX | 8h | Premium + Interest (damped) | Threshold filtering |
| Bybit | 8h | Premium + Interest (insurance) | Wide ranges (±2.5%), liquidation spikes |
| CME | 8h | Premium/8 + Interest + Carry | Carry cost (+0.05%) |
| SGX | 4h | Spread/4 + Interest | Conservative 50% application |
Spot-Perp-Funding Triangle
Section titled “Spot-Perp-Funding Triangle”Spot Price Process:
- Geometric Brownian Motion (GBM) with configurable drift/volatility
- Jump diffusion for tail events (liquidations, news shocks)
Funding Rate Dynamics:
- Ornstein-Uhlenbeck (OU) mean-reverting process
- Hard bounds to prevent unrealistic rates
- White noise component for micro-jitter
Perpetual Pricing:
Perp Price = Spot × (1 + Funding Rate + Basis Deviation)Slippage & Impact
Section titled “Slippage & Impact”Market orders eat through the order book. Large orders suffer slippage exactly as they would in production:
price_impact = weighted_average_price(filled_levels)No “flat slippage” assumptions—we calculate the weighted average price of filled levels.
Configuration Parameters
Section titled “Configuration Parameters”| Parameter | Description |
|---|---|
burst_probability | Chance of entering burst mode |
burst_intensity_factor | Message rate multiplier during burst |
staleness_ms | Mean network latency |
adverse_selection_strength | Depth depletion on aggressive flow |
impact_decay_halflife_ms | Recovery time for depleted depth |
spread_vol_sensitivity | Spread widening under volatility |
spread_toxicity_sensitivity | Spread widening under informed flow |
depth_decay_rate | Power-law decay away from touch |
trade_size_alpha | Pareto exponent for trade sizes |