Funding Models
import FundingClampDemo from ’../../components/docs/FundingClampDemo.astro’;
Exchange-Specific Funding Rate Models
Section titled “Exchange-Specific Funding Rate Models”This page explains (at a practical level) how funding is modeled across venues and how to use it in simulations.
What you’ll do
Section titled “What you’ll do”- Understand the inputs to funding (spot/index, mark, premium)
- See how different venues apply caps/damping/velocity
- Learn which API/MCP call to use to simulate funding
Key terms
Section titled “Key terms”- Index / spot price: the reference price for the underlying.
- Mark price: the price used for funding settlement (venue-specific construction).
- Premium: the deviation between mark and index.
- Funding rate: a periodic rate applied to positions; commonly derived from premium plus an interest component.
| Exchange | Funding Interval | Formula | Unique Features |
|---|---|---|---|
| Binance | 8 hours | Premium + Interest Rate | Soft/hard caps (±0.75%/±2%), damping |
| HyperLiquid | 8 hours | Premium × Velocity | Trend amplification, ±4% hard cap |
| OKX | 8 hours | Premium + Interest (damped) | Threshold filtering |
| Bybit | 8 hours | Premium + Interest (insurance) | Wide ranges (±2.5%), liquidation spikes |
| CME | 8 hours | Premium/8 + Interest + Carry | Carry cost component (+0.05%) |
| SGX | 4 hours | Spread/4 + Interest | Asian session, conservative pricing |
A minimal funding sketch
Section titled “A minimal funding sketch”In many venues, a simplified view looks like:
Where “clamp/caps” represents venue-specific damping, caps, thresholds, or velocity effects.
Exchange Models
Section titled “Exchange Models”1. Binance
Section titled “1. Binance”Characteristics:
- 8-hour funding intervals (00:00, 08:00, 16:00 UTC)
- Formula:
Funding Rate = Premium Index + Interest Rate (0.01%) - Soft cap: ±0.75%, Hard cap: ±2%
- Dampening factor: 0.95 (smooth convergence)
Implementation:
from aleatoric.venues import BinanceFundingModel
model = BinanceFundingModel()
# Calculate funding ratefunding_rate = model.calculate_funding_rate( spot_price=50000.0, mark_price=50050.0)
# Generate perp priceperp_price = model.generate_perp_price( spot_price=50000.0, funding_rate=0.0001, basis_std=0.0005 # Basis noise)
# Calculate settlement P&Lpnl = model.calculate_settlement_pnl( position_size=1.0, # 1 BTC long funding_rate=0.0001, mark_price=50000.0)Settlement Schedule:
settlements = model.get_settlement_times(num_periods=3)# [2025-01-01 00:00 UTC, 2025-01-01 08:00 UTC, 2025-01-01 16:00 UTC]2. HyperLiquid
Section titled “2. HyperLiquid”Characteristics:
- 8-hour funding intervals (default, can be 1-hour)
- Formula:
Funding Rate = Premium × Velocity Coefficient + Interest Rate - Low interest rate: 0.001% per hour (0.0124 bps per 8h)
- Velocity coefficient: Amplifies trending premiums (0.3x to 2.5x)
- Hard cap: ±4% (fixed)
- On-chain settlement (adds latency effects)
Unique Feature: Velocity Coefficient
from aleatoric.venues import HyperLiquidFundingModel
model = HyperLiquidFundingModel()
# Simulate trending premiumfor i in range(10): premium = 0.001 * i # Increasing premium mark = 100.0 * (1 + premium)
funding_rate = model.calculate_funding_rate( spot_price=100.0, mark_price=mark, use_velocity=True )
print(f"Velocity: {model.current_velocity:.2f}x, " f"Funding: {funding_rate * 10000:.2f} bps")
# Output shows velocity increasing from 1.0x to 2.0x+ as trend persistsKey Differences from Binance:
- Hourly vs 8-hourly (3x more frequent)
- Velocity amplification vs fixed formula
- Higher basis volatility (on-chain effects)
- Wider funding rate ranges
3. OKX
Section titled “3. OKX”Characteristics:
- 8-hour funding intervals
- Formula:
Funding Rate = Premium + Interest Rate(with damping) - Threshold damping: Reduces small premium noise
- Soft cap: ±0.5%, Hard cap: ±0.75%
Implementation:
from aleatoric.venues import OKXFundingModel
model = OKXFundingModel(clamp_threshold=0.0005)
# Small premiums are dampenedfunding_small = model.calculate_funding_rate( spot_price=50000.0, mark_price=50020.0 # 4 bps premium (below threshold))# funding_small will be halved due to damping
# Large premiums pass throughfunding_large = model.calculate_funding_rate( spot_price=50000.0, mark_price=50100.0 # 20 bps premium (above threshold))# funding_large unaffected by damping4. Bybit
Section titled “4. Bybit”Characteristics:
- 8-hour funding intervals
- Formula:
Funding Rate = Premium + Interest Rate(insurance dampened) - Wide funding ranges: Soft cap ±1%, Hard cap ±2.5%
- Insurance fund effect: Dampens extreme rates
- Liquidation spikes: 1% chance of 3x basis spikes
Implementation:
from aleatoric.venues import BybitFundingModel
model = BybitFundingModel()
## How to simulate funding
Use the MCP tool `simulate_funding_regime` (see [API Index](/docs/api-index) and [API Reference](/docs/api-reference)).
:::caution[Common mistakes]- Mixing units (bps vs decimals) when comparing outputs across systems.- Forgetting the funding interval when interpreting rates (per-hour vs per-interval).:::# Normal conditionsperp_price = model.generate_perp_price( spot_price=50000.0, funding_rate=0.0001, basis_std=0.0008 # Higher volatility than Binance)
# Perp pricing occasionally includes liquidation spikes:# 1% chance of 3x basis noise (cascade effect)5. CME (Chicago Mercantile Exchange)
Section titled “5. CME (Chicago Mercantile Exchange)”Characteristics:
- 8-hour funding intervals
- Formula:
Funding Rate = (Premium/8) + Interest Rate + Carry Target - Interest Rate: 0.015% per 8h
- Carry Target: +0.05% (additional spread for term structure)
- Basis cap: ±1.0%
- Cash settlement mechanics
Implementation:
from aleatoric.venues import CMEFundingModel
model = CMEFundingModel()
# Calculate funding ratefunding_rate = model.calculate_funding_rate( spot_price=50000.0, mark_price=50050.0)
# Generate perp priceperp_price = model.generate_perp_price( spot_price=50000.0, funding_rate=0.0001, basis_std=0.0004)6. SGX (Singapore Exchange)
Section titled “6. SGX (Singapore Exchange)”Characteristics:
- 4-hour funding intervals (unique - aligns with Asian session)
- Formula:
Funding Rate = (Spread/4) + Interest Rate - Interest Rate: 0.008% per 4h
- Soft cap: ±0.5%
- Conservative pricing: Only 50% of funding rate applied to perp price
Implementation:
from aleatoric.venues import SGXFundingModel
model = SGXFundingModel()
# Calculate funding ratefunding_rate = model.calculate_funding_rate( spot_price=50000.0, mark_price=50050.0)
# Generate perp price (conservative 50% application)perp_price = model.generate_perp_price( spot_price=50000.0, funding_rate=0.0001, basis_std=0.0003)Key Differences:
- Shorter settlement intervals (4h vs 8h)
- Conservative funding application reduces basis volatility
- Supports non-crypto assets (gold futures)
Use Cases
Section titled “Use Cases”1. Spot-Perp Arbitrage Modeling
Section titled “1. Spot-Perp Arbitrage Modeling”Test arbitrage strategies with realistic basis dynamics:
from aleatoric.venues import BinanceFundingModel, HyperLiquidFundingModel
binance = BinanceFundingModel()hyperliquid = HyperLiquidFundingModel()
# Same market conditionsspot = 50000.0mark = 50075.0
# Different funding ratesbinance_rate = binance.calculate_funding_rate(spot, mark)hyperliquid_rate = hyperliquid.calculate_funding_rate(spot, mark)
# Arbitrage opportunity if rates diverge significantlybasis_arb_bps = (hyperliquid_rate - binance_rate) * 100002. Funding Rate Risk Modeling
Section titled “2. Funding Rate Risk Modeling”Model funding rate volatility for risk management:
import numpy as npfrom aleatoric.venues import BinanceFundingModel
model = BinanceFundingModel()
# Simulate 30 days of funding ratesfunding_rates = []for day in range(30): for period in range(3): # 3 periods per day # Random premium premium = np.random.normal(0, 0.002) mark = 50000 * (1 + premium)
rate = model.calculate_funding_rate(50000, mark) funding_rates.append(rate)
# Calculate VaR on funding costsfunding_var_95 = np.percentile(funding_rates, 95)3. Strategy Backtesting
Section titled “3. Strategy Backtesting”Test perp trading strategies with exchange-specific mechanics:
# Test same strategy on different exchangesfrom aleatoric.venues import BinanceFundingModel, BybitFundingModel
binance = BinanceFundingModel()bybit = BybitFundingModel()
# Strategy: Long when funding < -0.05%position = 0.0binance_pnl = 0.0bybit_pnl = 0.0
for spot, mark in market_data: binance_rate = binance.calculate_funding_rate(spot, mark) bybit_rate = bybit.calculate_funding_rate(spot, mark)
# Different funding rates → different profitability if binance_rate < -0.0005: binance_pnl += binance.calculate_settlement_pnl(1.0, binance_rate, mark)
if bybit_rate < -0.0005: bybit_pnl += bybit.calculate_settlement_pnl(1.0, bybit_rate, mark)Comparison Table
Section titled “Comparison Table”| Feature | Binance | HyperLiquid | OKX | Bybit | CME | SGX |
|---|---|---|---|---|---|---|
| Interval | 8h | 8h | 8h | 8h | 8h | 4h |
| Frequency | 3x/day | 3x/day | 3x/day | 3x/day | 3x/day | 6x/day |
| Interest Rate | 0.01% | 0.001% | 0.01% | 0.01% | 0.015% | 0.008% |
| Velocity Coef | No | ✅ Yes | No | No | No | No |
| Soft Cap | ±0.75% | - | ±0.5% | ±1% | - | ±0.5% |
| Hard Cap | ±2% | ±4% | ±0.75% | ±2.5% | ±1% | ±0.5% |
| Threshold Damping | No | No | ✅ Yes | No | No | No |
| Insurance Effect | No | No | No | ✅ Yes | No | No |
| Carry Cost | No | No | No | No | ✅ Yes | No |
| Basis Volatility | Low | Medium | Low | High | Low | Low |
| On-Chain Latency | No | ✅ Yes | No | No | No | No |
Integration with Presets
Section titled “Integration with Presets”Each preset automatically uses the correct funding model:
from aleatoric.presets import get_presetfrom aleatoric.gen.single_asset import HyperSynthReactor
# Binance futures: 8h funding, Binance formulaconfig = get_preset("binance_futures_btc")market = HyperSynthReactor.from_config(config)
# HyperLiquid perps: 1h funding, velocity coefficientsconfig = get_preset("hyperliquid_perp_sol")market = HyperSynthReactor.from_config(config)Testing & Validation
Section titled “Testing & Validation”Run the funding rate comparison demo:
python examples/funding_rate_comparison.pyOutput shows:
- Funding rate calculations for each exchange
- Perp price generation with venue-specific effects
- Settlement P&L comparisons
- HyperLiquid velocity coefficient in action
Why This Matters
Section titled “Why This Matters”For Quants:
- Model spot-perp arbitrage with realistic basis dynamics
- Test funding rate risk strategies
- Validate perp pricing models
For Infrastructure:
- Stress test systems against different funding schedules
- Model settlement logic for each venue
- Validate P&L calculations
For Data Vendors:
- Offer venue-specific simulation datasets
- Differentiate from generic synthetic data
- Provide institution-grade training data
For Market Makers:
- Model funding rate exposure across venues
- Test hedging strategies for funding risk
- Optimize inventory based on funding schedules
📖 References
Section titled “📖 References”- Binance: https://www.binance.com/en/support/faq/perpetual-futures-funding-rate
- HyperLiquid: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/perpetuals
- OKX: https://www.okx.com/support/hc/en-us/articles/360053909272
- Bybit: https://www.bybit.com/en-US/help-center/bybitHC_Article?id=360039261134
Last Updated: 2025-12-22 Version: 0.4.1 Status: Production