SDK REST Usage
REST usage in the SDKs tracks the route model in the main REST reference.
Official clients for the core API in Python, TypeScript, and Rust.
REST usage
SDK method names stay close to the REST routes.
# pip install oxarchivefrom oxarchive import Client
client = Client(api_key="0xa_your_api_key")
# Hyperliquid datahl_orderbook = client.hyperliquid.orderbook.get("BTC")print(f"Hyperliquid BTC mid price: {hl_orderbook.mid_price}")
# Lighter.xyz datalighter_orderbook = client.lighter.orderbook.get("BTC")print(f"Lighter BTC mid price: {lighter_orderbook.mid_price}")
# HIP-3 builder perpship3_ob = client.hyperliquid.hip3.orderbook.get("xyz:XYZ100")print(f"HIP-3 XYZ100 mid price: {hip3_ob.mid_price}")
hip3_trades = client.hyperliquid.hip3.trades.recent("xyz:XYZ100", limit=10)print(f"Recent HIP-3 trades: {len(hip3_trades)}")
# Hyperliquid Spot (294 dashed pairs: PURR-USDC, HYPE-USDC, HFUN-USDC, ...)spot_ob = client.hyperliquid.spot.orderbook.get("PURR-USDC")print(f"Spot PURR-USDC mid price: {spot_ob.mid_price}")
spot_trades = client.hyperliquid.spot.trades.list( "PURR-USDC", start=1746489600000, end=1746576000000, limit=500)# Spot fills include builder_address, builder_fee, twap_id, fee_token (open-set), and a real EVM tx_hash on roughly 69% of rowsfor t in spot_trades.data[:3]: print(t.timestamp, t.price, t.fee_token, t.builder_address, t.twap_id)
# HIP-4 outcome markets (binary Yes/No)# Coins use the numeric id: 0 (Yes), 1 (No). The #-prefixed form ("#0", "#1") is also accepted.hip4_outcomes = client.hyperliquid.hip4.outcomes.list(is_settled=False, limit=5)for outcome in hip4_outcomes: print(f"Outcome {outcome.outcome_id}: {outcome.name}")
hip4_ob = client.hyperliquid.hip4.orderbook.get("0")print(f"HIP-4 outcome 0 (Yes) implied probability: {hip4_ob.mid_price}")
# Get trades with cursor paginationresult = client.hyperliquid.trades.list("ETH", start="2026-01-01", end="2026-01-02", limit=1000)trades = result.data
# Continue fetching all pageswhile result.next_cursor: result = client.hyperliquid.trades.list( "ETH", start="2026-01-01", end="2026-01-02", cursor=result.next_cursor, limit=1000 ) trades.extend(result.data)