Two New Ways to Access Market Data
We just shipped two new ways to access historical perpetual market data: a command-line interface and a native Rust SDK.
Both give you direct access to 34B+ orderbook snapshots, 3B+ fills, and funding/OI data across Hyperliquid, Hyperliquid HIP-3, and Lighter.xyz - the same data that powers our REST API, now available from your terminal and in native Rust.
Editor's note (March 25, 2026): 0xArchive exposes two top-level venue APIs, Hyperliquid and Lighter.xyz. HIP-3 markets live under the Hyperliquid namespace, even though the CLI accepts --exchange hip3 as a convenience scope.The CLI
The oxa CLI outputs JSON to stdout, errors to stderr, and uses deterministic exit codes. It's built for AI agents, shell scripts, and CI/CD pipelines - anything that benefits from structured, pipeable data.
Install
npm install -g @0xarchive/cliOr run without installing:
npx @0xarchive/cli auth testAuthenticate
export OXA_API_KEY="0xa_your_api_key"oxa auth testQuick Start
# Market summary - price, funding, OI, volume in one calloxa summary --exchange hyperliquid --symbol BTC
# 4h candles for backtestingoxa candles --exchange hyperliquid --symbol ETH \ --start 2026-02-01T00:00:00Z --end 2026-03-01T00:00:00Z --interval 4h
# Current funding rateoxa funding current --exchange hyperliquid --symbol BTC
# L2 orderbook snapshotoxa orderbook get --exchange hyperliquid --symbol BTC
# Recent trades from Lighter.xyzoxa trades fetch --exchange lighter --symbol BTC --limit 50
# List every available instrumentoxa instruments --exchange hyperliquid
# Check data freshness before actingoxa freshness --exchange hyperliquid --symbol BTCEvery command works across Hyperliquid core, Hyperliquid HIP-3, and Lighter.xyz. In the CLI, switch --exchange between hyperliquid, lighter, and hip3.
Commands
oxa auth test # Verify API keyoxa orderbook get # L2 orderbook snapshotoxa trades fetch # Trade history with cursor paginationoxa candles # OHLCV candle data (1m to 1w intervals)oxa funding current # Current funding rateoxa funding history # Funding rate historyoxa oi current # Current open interestoxa oi history # Open interest historyoxa instruments # List available instruments/coinsoxa liquidations # Liquidation history (Hyperliquid only)oxa summary # Multi-signal snapshot in one calloxa prices # Mark/oracle/mid price historyoxa freshness # Data freshness per data typeWhy a CLI?
Because your trading bot shouldn't need an HTTP client to check funding rates. Your AI agent shouldn't parse HTML to get orderbook state. Your backtest pipeline shouldn't import a library just to pull candles.
The CLI speaks JSON natively. Pipe it into jq, feed it to an LLM, or wire it into a shell script:
# Extract BTC mid priceoxa summary --exchange hyperliquid --symbol BTC | jq '.markPrice'
# Gate on data freshness before a tradeoxa freshness --exchange hyperliquid --symbol BTC \ | jq '.orderbook.lagMs < 5000'
# Scan all symbolsoxa instruments --exchange hyperliquid | jq '.[].name'
# Fetch candles and write to fileoxa candles --exchange hyperliquid --symbol ETH \ --start 2026-01-01T00:00:00Z --end 2026-02-01T00:00:00Z \ --interval 4h --out candles.jsonExit codes are deterministic: 0 success, 2 validation error, 3 auth error, 4 network/API error, 5 internal error. Agents can branch on them without parsing output.
The Rust SDK
The oxarchive crate is available on crates.io. Async by default, full type safety, and optional WebSocket support.
Install
Add to your Cargo.toml:
[dependencies]oxarchive = "1.1"tokio = { version = "1", features = ["rt-multi-thread", "macros"] }Quick Start
use oxarchive::OxArchive;
#[tokio::main]async fn main() -> oxarchive::Result<()> { let client = OxArchive::new("0xa_your_api_key")?;
// Hyperliquid orderbook let ob = client.hyperliquid.orderbook.get("BTC", None).await?; println!("Hyperliquid BTC mid price: {:?}", ob.mid_price);
// Lighter.xyz orderbook let lighter_ob = client.lighter.orderbook.get("BTC", None).await?; println!("Lighter BTC mid price: {:?}", lighter_ob.mid_price);
// HIP-3 builder perps (Pro tier required) let hip3_ob = client.hyperliquid.hip3.orderbook.get("xyz:XYZ100", None).await?; println!("HIP-3 XYZ100 mid price: {:?}", hip3_ob.mid_price);
Ok(())}Trades with Cursor Pagination
use oxarchive::{OxArchive, resources::trades::GetTradesParams};
#[tokio::main]async fn main() -> oxarchive::Result<()> { let client = OxArchive::new("0xa_your_api_key")?;
let mut result = client.hyperliquid.trades.list("ETH", GetTradesParams { start: 1767225600000_i64.into(), // 2026-01-01 end: 1767312000000_i64.into(), // 2026-01-02 limit: Some(1000), cursor: None, side: None, }).await?; let mut trades = result.data;
while let Some(cursor) = result.next_cursor { result = client.hyperliquid.trades.list("ETH", GetTradesParams { start: 1767225600000_i64.into(), end: 1767312000000_i64.into(), cursor: Some(cursor), limit: Some(1000), side: None, }).await?; trades.extend(result.data); }
println!("Fetched {} trades", trades.len()); Ok(())}WebSocket Historical Replay
Enable with the websocket feature flag:
oxarchive = { version = "1.1", features = ["websocket"] }// Replay orderbook data at 10x speedws.replay("orderbook", "BTC", 1767225600000, None, Some(10.0)).await?;
// Messages arrive through the same rx channelwhile let Some(msg) = rx.recv().await { match msg { ServerMsg::HistoricalData { channel, coin, timestamp, data } => { println!("[{timestamp}] {channel} {coin:?}: {data}"); } ServerMsg::ReplayCompleted { .. } => break, _ => {} }}Full SDK Lineup
This brings us to four official interfaces:
npm i -g @0xarchive/cli - JSON stdout, deterministic exit codescargo add oxarchive - async (tokio), WebSocket via feature flag, native typespip install oxarchive - sync + async, WebSocket via optional extra, Pydantic modelsnpm i @0xarchive/sdk - async/await, WebSocket built-in, full TypeScript typesSame data. Same API. Pick your language.
What's Behind the API
All live-ingested with sub-second freshness on orderbooks. Hyperliquid fills backfilled hourly.
Get Started
1. Sign up for a free account
2. Generate an API key from the dashboard
3. Pick your tool:
# CLI - first data in 30 secondsnpm i -g @0xarchive/cliexport OXA_API_KEY="0xa_your_api_key"oxa summary --exchange hyperliquid --symbol BTC
# Rustcargo add oxarchive tokio
# Pythonpip install oxarchive
# TypeScriptnpm i @0xarchive/sdkRead the docs to dive deeper.
