SDKs

Use the official clients for typed market, order-level, data-quality, and web3 flows that match the API.

Languages
Python, TypeScript, Rust
Protocols
REST and WebSocket
For
Typed app integrations

Use the official clients for typed requests across market data, order-level routes, data-quality monitoring, and wallet/web3 flows.

Installation

Install the package for your runtime, then make the first REST or WebSocket call.

Python

Bash
pip install oxarchive

TypeScript / Node.js

Bash
npm install @0xarchive/sdk

Rust

Bash
cargo add oxarchive

REST usage

Begin with one client, one key, and one request. The SDK method names stay close to the REST reference.

# pip install oxarchive
from oxarchive import Client
client = Client(api_key="0xa_your_api_key")
# Hyperliquid data
hl_orderbook = client.hyperliquid.orderbook.get("BTC")
print(f"Hyperliquid BTC mid price: {hl_orderbook.mid_price}")
# Lighter.xyz data
lighter_orderbook = client.lighter.orderbook.get("BTC")
print(f"Lighter BTC mid price: {lighter_orderbook.mid_price}")
# HIP-3 builder perps
hip3_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)}")
# Get trades with cursor pagination
result = client.hyperliquid.trades.list("ETH", start="2026-01-01", end="2026-01-02", limit=1000)
trades = result.data
# Continue fetching all pages
while 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)

The published SDKs also expose data-quality monitoring and wallet/web3 helpers. Use Agentic Gateway when the integration needs SIWE signup or x402 upgrades.

WebSocket usage

The same client handles live subscriptions and replay. The SDK examples follow the same connection model as the WebSocket docs.

import asyncio
from oxarchive import OxArchiveWs, WsOptions
async def main():
ws = OxArchiveWs(WsOptions(api_key="0xa_your_api_key"))
# Subscribe to real-time data
ws.on_orderbook(lambda coin, data: print(f"{coin}: {data.mid_price}"))
await ws.connect()
ws.subscribe_orderbook("BTC")
# Or replay historical data
await ws.replay("orderbook", "BTC", start=1704067200000, speed=10)
asyncio.run(main())

Order book reconstruction

Enterprise helpers rebuild Lighter tick history from checkpoints and deltas.

Tier
Enterprise
For
Tick-level Lighter order book history
Preferred path
Auto-paginating iterator
# Orderbook Reconstruction (Enterprise tier only)
from oxarchive import Client, OrderBookReconstructor
client = Client(api_key="0xa_your_api_key")
# Option 1: Auto-paginating iterator (recommended for large time ranges)
# Automatically handles pagination, fetching up to 1,000 deltas per request
for snapshot in client.lighter.orderbook.iterate_tick_history(
"BTC",
start="2026-01-01T00:00:00Z",
end="2026-01-01T12:00:00Z" # 12 hours of data
):
print(f"{snapshot.timestamp}: mid={snapshot.mid_price}")
if some_condition:
break # Early exit supported
# Option 2: Get fully reconstructed snapshots (single page)
snapshots = client.lighter.orderbook.history_reconstructed(
"BTC",
start="2026-01-01T00:00:00Z",
end="2026-01-01T01:00:00Z"
)
for ob in snapshots:
print(f"{ob.timestamp}: bid={ob.bids[0].px} ask={ob.asks[0].px}")
# Option 3: Get raw tick data for custom reconstruction
tick_data = client.lighter.orderbook.history_tick("BTC", start=start, end=end)
print(f"Checkpoint: {len(tick_data.checkpoint.bids)} bids")
print(f"Deltas: {len(tick_data.deltas)} updates")
# Check for sequence gaps
gaps = OrderBookReconstructor.detect_gaps(tick_data.deltas)
if gaps:
print("Gaps detected:", gaps)
MethodBest useNotes
iterateTickHistory()Long windows and production replayAuto-paginates and handles large delta ranges cleanly.
historyTick()Raw checkpoints and deltasSingle page, maximum 1,000 deltas.
historyReconstructed()Direct reconstructed snapshotsSingle page when you need the finished book immediately.
detectGaps()Continuity checksUse before backtests or downstream reconstruction pipelines.

Published packages

Pick the package that matches your stack, then use the registry entry for install and versioning.

Python SDK

Async client with typed models for research scripts, services, and notebooks.

TypeScript SDK

Typed browser and Node client for REST, replay, and live streaming.

Rust SDK

Async Rust client for low-latency services and strongly typed integrations.

CLI and examples

Use the CLI for shell automation and the examples repo for working reference projects.

Where to take the SDK next