Skip to content

Microstructure Models

Unlike generic synthetic data generators that emit perfect metronome ticks, The Aleatoric Engine replicates real exchange behavior.

market = HyperSynthReactor(
symbol="SOL",
book_update_interval_ms=100, # Match Binance 100ms snapshot rate
trade_intensity_base=2.0, # ~2 trades/sec baseline
)

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.

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) and capture_time_ms (receive time)

Liquidity providers react to aggressive flow:

market = HyperSynthReactor(
adverse_selection_strength=0.15, # 15% depth depletion
impact_decay_halflife_ms=5000.0, # 5s recovery
)
  • 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 impact
spread_toxicity_sensitivity=0.25, # Informed flow impact

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_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).

The engine models the ACTUAL implementation of each exchange:

ExchangeIntervalFormulaUnique Features
Binance8hPremium + Interest RateSoft/hard caps (±0.75%/±2%), damping
HyperLiquid8hPremium × VelocityTrend amplification (0.3x-2.5x), ±4% cap
OKX8hPremium + Interest (damped)Threshold filtering
Bybit8hPremium + Interest (insurance)Wide ranges (±2.5%), liquidation spikes
CME8hPremium/8 + Interest + CarryCarry cost (+0.05%)
SGX4hSpread/4 + InterestConservative 50% application

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)

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.

ParameterDescription
burst_probabilityChance of entering burst mode
burst_intensity_factorMessage rate multiplier during burst
staleness_msMean network latency
adverse_selection_strengthDepth depletion on aggressive flow
impact_decay_halflife_msRecovery time for depleted depth
spread_vol_sensitivitySpread widening under volatility
spread_toxicity_sensitivitySpread widening under informed flow
depth_decay_ratePower-law decay away from touch
trade_size_alphaPareto exponent for trade sizes