Hyperliquid Local Testnet, Backtesting & Perpetual Funding Simulator
Testing a Hyperliquid market-making or execution bot on public testnet gives misleading results because testnet order books have synthetic spreads, near-zero queue depth, and no informed arbitrage flow. Meanwhile, OHLCV candle backtesters ignore Alo (Add Liquidity Only) post-only rejections, atomic batchModify queue loss, maker fee rebates, and cross-margin liquidations.
1. Mirror Live Hyperliquid Mainnet Depth Locally
pip install feraterra # Start local Hyperliquid Shadow-CLOB (:8085 HTTP/WS, :8086 RFC 6455 WS, :8090 Diagnostics UI) feraterra up --venue hyperliquid --symbols BTC-PERP,ETH-PERP,SOL-PERP --cancel-latency-ms 120
2. Drop-In hyperliquid-python-sdk Compatibility
Fera Terra implements Hyperliquid's wire endpoints locally — including /info (meta, metaAndAssetCtxs, l2Book, allMids, clearinghouseState, openOrders, userFills, orderStatus), /exchange (order with Alo/Gtc/Ioc/Fok, cancel, cancelByCloid, modify, batchModify, scheduleCancel, updateLeverage), and WebSocket streams:
from hyperliquid.info import Info
info = Info(base_url="http://127.0.0.1:8085", skip_ws=False)
meta, ctxs = info.meta_and_asset_ctxs()
book = info.l2_snapshot("BTC")
print("Shadow BTC perp levels:", len(book["levels"][0]), len(book["levels"][1]))
3. Stress-Test Against 5-Sigma Liquidation & Funding Cascades
# Gate Rust, Go, or Python bots in GitHub Actions against funding squeezes & 5-sigma crashes: feraterra ci-gate \ --pack whipsaw_funding_squeeze \ --bot-cmd "./target/release/hl-perp-mm" \ --cancel-latency-ms 120 \ --min-fifo-pnl -150.0 \ --max-cancel-snipes 6 \ --html-out hl-ci-report.html
Clone runnable ETH-PERP funding-squeeze and BTC-PERP 5-sigma crash tapes at FeraTerra/hyperliquid-backtest-sim.