# Hyperlight API — Features

> Last updated: 2026-03-14

## Core Features

### Batch Account Queries

Query positions, fills, and liquidations across 1,000+ accounts in a single call.

Instead of looping through accounts one by one, send a single POST with up to 1,000 account indices. The response includes positions, open orders, and recent fills for every account — perfect for portfolio dashboards and risk monitoring.

```
POST /api/v1/accounts/batch
{ "accounts": [0, 1, 2, …, 999], "by": "index" }

→ 1000 accounts in a single request
```

### Enriched WebSocket Streams

See who is placing orders, not just what orders exist. Every stream message includes account attribution and whale flags.

Standard Lighter streams show anonymous orders. Hyperlight enriches every message with the submitting account index, flags large orders above configurable thresholds, and offers depth-aggregated views at custom tick sizes.

```
wss://api.hyperlightapi.xyz/stream
subscribe: { "channel": "order_book/0" }

→ { "account": 42, "side": "bid", "whale": true }
```

### Backtesting Replay

Replay historical market data via WebSocket at 0.1x–100x speed with pause and scrub.

Point your bot at a replay WebSocket endpoint. Specify a time range and playback speed. Messages arrive in the exact sequence they originally occurred — so your strategy code runs identically to how it would have in production.

```
wss://api.hyperlightapi.xyz/ws/replay
→ { "type": "replay", "market_id": 0,
    "start": "2025-01-01", "speed": 10 }

→ streams historical data at 10x speed
```

## Additional Features

### Historical Data Lake

Parquet exports of trades, orderbook snapshots, candles, and funding rates for backtesting.

Every second, Hyperlight snapshots the full orderbook across all markets. Combined with tick-level trade data, this creates a high-fidelity historical dataset exported as Parquet files.

### Time-Range Queries

Fetch trades, funding rates, and candles for arbitrary time ranges with flexible pagination.

Lighter’s native API only supports cursor-based pagination from the latest data backward. Hyperlight adds start/end timestamp parameters, forward pagination, and configurable page sizes.

### Production Infra

Tiered rate limiting, SHA-256 key storage, Prometheus metrics, and low-latency Rust performance.

Built entirely in Rust with Axum and Tokio. API keys are SHA-256 hashed before storage. Rate limits are enforced per-key with Redis sliding windows.

## Feature Comparison: Hyperlight vs Lighter Native API

| Capability | Lighter Native | Hyperlight |
|---|---|---|
| Batch account queries | 1 account per request | Up to 1,000 accounts per request |
| Trade time-range queries | Cursor-only pagination | Arbitrary start/end timestamps |
| Trade aggregation (VWAP) | Not available | Custom intervals (1m-1d) |
| Historical orderbook | Current only | Any point in time (1s resolution) |
| Orderbook depth aggregation | Not available | Custom tick sizes |
| Parquet data exports | Not available | Hourly/daily exports |
| Backtesting replay | Not available | 0.1x-100x speed via WebSocket |
| Account attribution on streams | Anonymous | Full account attribution + whale flags |
| Rate limiting | Unspecified | Tiered (30 to unlimited req/min) |
| API key management | N/A | SHA-256 hashed, IP allowlisting |
| Liquidation heatmap | Not available | Per-market position risk by price level |
| Cascade simulation | Not available | Model cascading liquidation effects |
| Account liquidation risk | Not available | Per-position margin & distance analysis |
| Custom alert signals | Not available | JSON DSL rules with webhook + HMAC signing |
| Signal backtesting | Not available | Test rules against historical trade data |