@0xarchive/sdk 0.9.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -111
- package/dist/index.d.mts +283 -64
- package/dist/index.d.ts +283 -64
- package/dist/index.js +254 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +254 -84
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Official TypeScript/JavaScript SDK for [0xarchive](https://0xarchive.io) - Histo
|
|
|
4
4
|
|
|
5
5
|
Supports multiple exchanges:
|
|
6
6
|
- **Hyperliquid** - Perpetuals data from April 2023
|
|
7
|
-
- **Hyperliquid HIP-3** - Builder-deployed perpetuals (
|
|
7
|
+
- **Hyperliquid HIP-3** - Builder-deployed perpetuals (February 2026+, free tier: km:US500, Build+: all symbols, Pro+: orderbook history)
|
|
8
8
|
- **Lighter.xyz** - Perpetuals data (August 2025+ for fills, Jan 2026+ for OB, OI, Funding Rate)
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
@@ -60,7 +60,7 @@ const client = new OxArchive({
|
|
|
60
60
|
|
|
61
61
|
## REST API Reference
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
Core resources (orderbook, trades, instruments, funding, openInterest, candles, freshness, summary, priceHistory) are available on both `client.hyperliquid.*` and `client.lighter.*`. Some resources are exchange-specific -- see each section for details.
|
|
64
64
|
|
|
65
65
|
### Order Book
|
|
66
66
|
|
|
@@ -232,7 +232,7 @@ while (result.nextCursor) {
|
|
|
232
232
|
const recent = await client.lighter.trades.recent('BTC', 100);
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
**Note:** The `recent()` method is
|
|
235
|
+
**Note:** The `recent()` method is available for Lighter.xyz (`client.lighter.trades.recent()`) and HIP-3 (`client.hyperliquid.hip3.trades.recent()`). Hyperliquid does not have a recent trades endpoint -- use `list()` with a time range instead.
|
|
236
236
|
|
|
237
237
|
### Instruments
|
|
238
238
|
|
|
@@ -353,12 +353,12 @@ const hourly = await client.hyperliquid.openInterest.history('BTC', {
|
|
|
353
353
|
| `limit` | `number` | No | Max results (default: 100, max: 1000) |
|
|
354
354
|
| `interval` | `OiFundingInterval` | No | Aggregation interval: `'5m'`, `'15m'`, `'30m'`, `'1h'`, `'4h'`, `'1d'`. When omitted, raw ~1 min data is returned. |
|
|
355
355
|
|
|
356
|
-
### Liquidations
|
|
356
|
+
### Liquidations
|
|
357
357
|
|
|
358
|
-
Get historical liquidation events. Data available from May 2025 onwards.
|
|
358
|
+
Get historical liquidation events. Data available from May 2025 onwards for Hyperliquid, and from February 2026 for HIP-3.
|
|
359
359
|
|
|
360
360
|
```typescript
|
|
361
|
-
// Get liquidation history for a coin
|
|
361
|
+
// Get liquidation history for a coin (Hyperliquid)
|
|
362
362
|
const liquidations = await client.hyperliquid.liquidations.history('BTC', {
|
|
363
363
|
start: Date.now() - 86400000,
|
|
364
364
|
end: Date.now(),
|
|
@@ -383,14 +383,21 @@ const userLiquidations = await client.hyperliquid.liquidations.byUser('0x1234...
|
|
|
383
383
|
end: Date.now(),
|
|
384
384
|
coin: 'BTC' // optional filter
|
|
385
385
|
});
|
|
386
|
+
|
|
387
|
+
// HIP-3 liquidations (case-sensitive coins)
|
|
388
|
+
const hip3Liquidations = await client.hyperliquid.hip3.liquidations.history('km:US500', {
|
|
389
|
+
start: Date.now() - 86400000,
|
|
390
|
+
end: Date.now(),
|
|
391
|
+
limit: 100
|
|
392
|
+
});
|
|
386
393
|
```
|
|
387
394
|
|
|
388
|
-
### Liquidation Volume
|
|
395
|
+
### Liquidation Volume
|
|
389
396
|
|
|
390
397
|
Get pre-aggregated liquidation volume in time-bucketed intervals. Returns total, long, and short USD volumes per bucket -- 100-1000x less data than individual liquidation records.
|
|
391
398
|
|
|
392
399
|
```typescript
|
|
393
|
-
// Get hourly liquidation volume for the last week
|
|
400
|
+
// Get hourly liquidation volume for the last week (Hyperliquid)
|
|
394
401
|
const volume = await client.hyperliquid.liquidations.volume('BTC', {
|
|
395
402
|
start: Date.now() - 86400000 * 7,
|
|
396
403
|
end: Date.now(),
|
|
@@ -400,11 +407,170 @@ const volume = await client.hyperliquid.liquidations.volume('BTC', {
|
|
|
400
407
|
for (const bucket of volume.data) {
|
|
401
408
|
console.log(`${bucket.timestamp}: total=$${bucket.totalUsd}, long=$${bucket.longUsd}, short=$${bucket.shortUsd}`);
|
|
402
409
|
}
|
|
410
|
+
|
|
411
|
+
// HIP-3 liquidation volume (case-sensitive coins)
|
|
412
|
+
const hip3Volume = await client.hyperliquid.hip3.liquidations.volume('km:US500', {
|
|
413
|
+
start: Date.now() - 86400000 * 7,
|
|
414
|
+
end: Date.now(),
|
|
415
|
+
interval: '1h'
|
|
416
|
+
});
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Orders
|
|
420
|
+
|
|
421
|
+
Access order history, order flow aggregations, and TP/SL (take-profit/stop-loss) orders. Available for Hyperliquid and HIP-3.
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
// Get order history for a coin
|
|
425
|
+
const orders = await client.hyperliquid.orders.history('BTC', {
|
|
426
|
+
start: Date.now() - 86400000,
|
|
427
|
+
end: Date.now(),
|
|
428
|
+
limit: 1000,
|
|
429
|
+
user: '0x1234...', // optional: filter by user address
|
|
430
|
+
status: 'filled', // optional: filter by status
|
|
431
|
+
order_type: 'limit', // optional: filter by order type
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
// Paginate through all results
|
|
435
|
+
const allOrders = [...orders.data];
|
|
436
|
+
while (orders.nextCursor) {
|
|
437
|
+
const next = await client.hyperliquid.orders.history('BTC', {
|
|
438
|
+
start: Date.now() - 86400000,
|
|
439
|
+
end: Date.now(),
|
|
440
|
+
cursor: orders.nextCursor,
|
|
441
|
+
limit: 1000
|
|
442
|
+
});
|
|
443
|
+
allOrders.push(...next.data);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Get order flow (aggregated order activity over time)
|
|
447
|
+
const flow = await client.hyperliquid.orders.flow('BTC', {
|
|
448
|
+
start: Date.now() - 86400000,
|
|
449
|
+
end: Date.now(),
|
|
450
|
+
interval: '1h', // optional aggregation interval
|
|
451
|
+
limit: 100
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
// Get TP/SL orders
|
|
455
|
+
const tpsl = await client.hyperliquid.orders.tpsl('BTC', {
|
|
456
|
+
start: Date.now() - 86400000,
|
|
457
|
+
end: Date.now(),
|
|
458
|
+
user: '0x1234...', // optional: filter by user
|
|
459
|
+
triggered: true, // optional: filter by triggered status
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
// HIP-3 orders (case-sensitive coins)
|
|
463
|
+
const hip3Orders = await client.hyperliquid.hip3.orders.history('km:US500', {
|
|
464
|
+
start: Date.now() - 86400000,
|
|
465
|
+
end: Date.now(),
|
|
466
|
+
limit: 1000
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
const hip3Flow = await client.hyperliquid.hip3.orders.flow('km:US500', {
|
|
470
|
+
start: Date.now() - 86400000,
|
|
471
|
+
end: Date.now(),
|
|
472
|
+
interval: '1h'
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
const hip3Tpsl = await client.hyperliquid.hip3.orders.tpsl('km:US500', {
|
|
476
|
+
start: Date.now() - 86400000,
|
|
477
|
+
end: Date.now()
|
|
478
|
+
});
|
|
403
479
|
```
|
|
404
480
|
|
|
405
|
-
###
|
|
481
|
+
### L4 Order Book
|
|
406
482
|
|
|
407
|
-
|
|
483
|
+
Access L4 orderbook snapshots, diffs, and history. L4 data includes user attribution (who placed each order). Available for Hyperliquid and HIP-3.
|
|
484
|
+
|
|
485
|
+
```typescript
|
|
486
|
+
// Get current L4 orderbook snapshot
|
|
487
|
+
const l4Ob = await client.hyperliquid.l4Orderbook.get('BTC');
|
|
488
|
+
|
|
489
|
+
// Get L4 orderbook at a specific timestamp with custom depth
|
|
490
|
+
const l4Historical = await client.hyperliquid.l4Orderbook.get('BTC', {
|
|
491
|
+
timestamp: 1704067200000,
|
|
492
|
+
depth: 20
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// Get L4 orderbook diffs (incremental updates)
|
|
496
|
+
const diffs = await client.hyperliquid.l4Orderbook.diffs('BTC', {
|
|
497
|
+
start: Date.now() - 3600000,
|
|
498
|
+
end: Date.now(),
|
|
499
|
+
limit: 1000
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
// Paginate through diffs
|
|
503
|
+
const allDiffs = [...diffs.data];
|
|
504
|
+
while (diffs.nextCursor) {
|
|
505
|
+
const next = await client.hyperliquid.l4Orderbook.diffs('BTC', {
|
|
506
|
+
start: Date.now() - 3600000,
|
|
507
|
+
end: Date.now(),
|
|
508
|
+
cursor: diffs.nextCursor,
|
|
509
|
+
limit: 1000
|
|
510
|
+
});
|
|
511
|
+
allDiffs.push(...next.data);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// Get L4 orderbook history (full snapshots over time)
|
|
515
|
+
const l4History = await client.hyperliquid.l4Orderbook.history('BTC', {
|
|
516
|
+
start: Date.now() - 86400000,
|
|
517
|
+
end: Date.now(),
|
|
518
|
+
limit: 1000
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
// HIP-3 L4 orderbook (case-sensitive coins)
|
|
522
|
+
const hip3L4 = await client.hyperliquid.hip3.l4Orderbook.get('km:US500');
|
|
523
|
+
|
|
524
|
+
const hip3L4Diffs = await client.hyperliquid.hip3.l4Orderbook.diffs('km:US500', {
|
|
525
|
+
start: Date.now() - 3600000,
|
|
526
|
+
end: Date.now(),
|
|
527
|
+
limit: 1000
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
const hip3L4History = await client.hyperliquid.hip3.l4Orderbook.history('km:US500', {
|
|
531
|
+
start: Date.now() - 86400000,
|
|
532
|
+
end: Date.now(),
|
|
533
|
+
limit: 1000
|
|
534
|
+
});
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### L3 Order Book (Lighter only)
|
|
538
|
+
|
|
539
|
+
Access L3 orderbook snapshots and history from Lighter.xyz. L3 data includes individual order-level detail.
|
|
540
|
+
|
|
541
|
+
```typescript
|
|
542
|
+
// Get current L3 orderbook
|
|
543
|
+
const l3Ob = await client.lighter.l3Orderbook.get('BTC');
|
|
544
|
+
|
|
545
|
+
// Get L3 orderbook at a specific timestamp with custom depth
|
|
546
|
+
const l3Historical = await client.lighter.l3Orderbook.get('BTC', {
|
|
547
|
+
timestamp: 1704067200000,
|
|
548
|
+
depth: 20
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
// Get L3 orderbook history
|
|
552
|
+
const l3History = await client.lighter.l3Orderbook.history('BTC', {
|
|
553
|
+
start: Date.now() - 86400000,
|
|
554
|
+
end: Date.now(),
|
|
555
|
+
limit: 1000
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
// Paginate through L3 history
|
|
559
|
+
const allL3 = [...l3History.data];
|
|
560
|
+
while (l3History.nextCursor) {
|
|
561
|
+
const next = await client.lighter.l3Orderbook.history('BTC', {
|
|
562
|
+
start: Date.now() - 86400000,
|
|
563
|
+
end: Date.now(),
|
|
564
|
+
cursor: l3History.nextCursor,
|
|
565
|
+
limit: 1000
|
|
566
|
+
});
|
|
567
|
+
allL3.push(...next.data);
|
|
568
|
+
}
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
### Freshness
|
|
572
|
+
|
|
573
|
+
Check when each data type was last updated for a specific coin. Useful for verifying data recency before pulling it. Available for all exchanges.
|
|
408
574
|
|
|
409
575
|
```typescript
|
|
410
576
|
// Hyperliquid
|
|
@@ -754,7 +920,7 @@ const trades = await client.trades.list('BTC', { start, end });
|
|
|
754
920
|
|
|
755
921
|
## WebSocket Client
|
|
756
922
|
|
|
757
|
-
The WebSocket client supports
|
|
923
|
+
The WebSocket client supports two modes: real-time streaming and historical replay. For bulk data downloads, use the S3 Parquet bulk export via the [Data Explorer](https://0xarchive.io/data).
|
|
758
924
|
|
|
759
925
|
```typescript
|
|
760
926
|
import { OxArchiveWs } from '@0xarchive/sdk';
|
|
@@ -848,53 +1014,12 @@ ws.replaySeek(1704067200000); // Jump to timestamp
|
|
|
848
1014
|
ws.replayStop();
|
|
849
1015
|
```
|
|
850
1016
|
|
|
851
|
-
### Bulk Streaming
|
|
852
|
-
|
|
853
|
-
Fast bulk download for data pipelines. Data arrives in batches without timing delays.
|
|
854
|
-
|
|
855
|
-
```typescript
|
|
856
|
-
const ws = new OxArchiveWs({ apiKey: 'ox_...' });
|
|
857
|
-
ws.connect();
|
|
858
|
-
|
|
859
|
-
const allData: OrderBook[] = [];
|
|
860
|
-
|
|
861
|
-
// Handle batched data
|
|
862
|
-
ws.onBatch((coin, records) => {
|
|
863
|
-
allData.push(...records.map(r => r.data));
|
|
864
|
-
});
|
|
865
|
-
|
|
866
|
-
ws.onStreamProgress((snapshotsSent) => {
|
|
867
|
-
console.log(`Progress: ${snapshotsSent} snapshots`);
|
|
868
|
-
});
|
|
869
|
-
|
|
870
|
-
ws.onStreamComplete((channel, coin, recordsSent) => {
|
|
871
|
-
console.log(`Downloaded ${recordsSent} records`);
|
|
872
|
-
});
|
|
873
|
-
|
|
874
|
-
// Start bulk stream
|
|
875
|
-
ws.stream('orderbook', 'ETH', {
|
|
876
|
-
start: Date.now() - 3600000, // 1 hour ago
|
|
877
|
-
end: Date.now(),
|
|
878
|
-
batchSize: 1000 // Optional, defaults to 1000
|
|
879
|
-
});
|
|
880
|
-
|
|
881
|
-
// Lighter.xyz stream with granularity (tier restrictions apply)
|
|
882
|
-
ws.stream('orderbook', 'BTC', {
|
|
883
|
-
start: Date.now() - 3600000,
|
|
884
|
-
end: Date.now(),
|
|
885
|
-
granularity: '10s' // Options: 'checkpoint', '30s', '10s', '1s', 'tick'
|
|
886
|
-
});
|
|
887
|
-
|
|
888
|
-
// Stop if needed
|
|
889
|
-
ws.streamStop();
|
|
890
|
-
```
|
|
891
|
-
|
|
892
1017
|
### Gap Detection
|
|
893
1018
|
|
|
894
|
-
During historical replay
|
|
1019
|
+
During historical replay, the server automatically detects gaps in the data and notifies the client. This helps identify periods where data may be missing.
|
|
895
1020
|
|
|
896
1021
|
```typescript
|
|
897
|
-
// Handle gap notifications during replay
|
|
1022
|
+
// Handle gap notifications during replay
|
|
898
1023
|
ws.onGap((channel, coin, gapStart, gapEnd, durationMinutes) => {
|
|
899
1024
|
console.log(`Gap detected in ${channel}/${coin}:`);
|
|
900
1025
|
console.log(` From: ${new Date(gapStart).toISOString()}`);
|
|
@@ -935,8 +1060,8 @@ const ws = new OxArchiveWs({
|
|
|
935
1060
|
|---------|-------------|---------------|-------------------|
|
|
936
1061
|
| `orderbook` | L2 order book updates | Yes | Yes |
|
|
937
1062
|
| `trades` | Trade/fill updates | Yes | Yes |
|
|
938
|
-
| `candles` | OHLCV candle data | Yes | Yes (replay
|
|
939
|
-
| `liquidations` | Liquidation events (May 2025+) | Yes | Yes (replay
|
|
1063
|
+
| `candles` | OHLCV candle data | Yes | Yes (replay only) |
|
|
1064
|
+
| `liquidations` | Liquidation events (May 2025+) | Yes | Yes (replay only) |
|
|
940
1065
|
| `open_interest` | Open interest snapshots | Yes | Replay/stream only |
|
|
941
1066
|
| `funding` | Funding rate snapshots | Yes | Replay/stream only |
|
|
942
1067
|
| `ticker` | Price and 24h volume | Yes | Real-time only |
|
|
@@ -951,6 +1076,7 @@ const ws = new OxArchiveWs({
|
|
|
951
1076
|
| `hip3_candles` | HIP-3 OHLCV candle data | Yes | Yes |
|
|
952
1077
|
| `hip3_open_interest` | HIP-3 open interest snapshots | Yes | Replay/stream only |
|
|
953
1078
|
| `hip3_funding` | HIP-3 funding rate snapshots | Yes | Replay/stream only |
|
|
1079
|
+
| `hip3_liquidations` | HIP-3 liquidation events (Feb 2026+) | Yes | Yes (replay only) |
|
|
954
1080
|
|
|
955
1081
|
> **Note:** HIP-3 coins are case-sensitive (e.g., `km:US500`, `xyz:XYZ100`). Do not uppercase them.
|
|
956
1082
|
|
|
@@ -963,6 +1089,7 @@ const ws = new OxArchiveWs({
|
|
|
963
1089
|
| `lighter_candles` | Lighter OHLCV candle data | Yes | Yes |
|
|
964
1090
|
| `lighter_open_interest` | Lighter open interest snapshots | Yes | Replay/stream only |
|
|
965
1091
|
| `lighter_funding` | Lighter funding rate snapshots | Yes | Replay/stream only |
|
|
1092
|
+
| `lighter_l3_orderbook` | Lighter L3 order-level orderbook (Pro+) | Yes | Yes |
|
|
966
1093
|
|
|
967
1094
|
#### Candle Replay/Stream
|
|
968
1095
|
|
|
@@ -975,14 +1102,6 @@ ws.replay('candles', 'BTC', {
|
|
|
975
1102
|
interval: '15m' // 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w
|
|
976
1103
|
});
|
|
977
1104
|
|
|
978
|
-
// Bulk stream candles
|
|
979
|
-
ws.stream('candles', 'ETH', {
|
|
980
|
-
start: Date.now() - 3600000,
|
|
981
|
-
end: Date.now(),
|
|
982
|
-
batchSize: 1000,
|
|
983
|
-
interval: '1h'
|
|
984
|
-
});
|
|
985
|
-
|
|
986
1105
|
// Lighter.xyz candles
|
|
987
1106
|
ws.replay('lighter_candles', 'BTC', {
|
|
988
1107
|
start: Date.now() - 86400000,
|
|
@@ -991,7 +1110,7 @@ ws.replay('lighter_candles', 'BTC', {
|
|
|
991
1110
|
});
|
|
992
1111
|
```
|
|
993
1112
|
|
|
994
|
-
#### HIP-3 Replay
|
|
1113
|
+
#### HIP-3 Replay
|
|
995
1114
|
|
|
996
1115
|
```typescript
|
|
997
1116
|
// Replay HIP-3 orderbook at 50x speed
|
|
@@ -1001,13 +1120,6 @@ ws.replay('hip3_orderbook', 'km:US500', {
|
|
|
1001
1120
|
speed: 50,
|
|
1002
1121
|
});
|
|
1003
1122
|
|
|
1004
|
-
// Bulk stream HIP-3 trades
|
|
1005
|
-
ws.stream('hip3_trades', 'xyz:XYZ100', {
|
|
1006
|
-
start: Date.now() - 86400000,
|
|
1007
|
-
end: Date.now(),
|
|
1008
|
-
batchSize: 1000,
|
|
1009
|
-
});
|
|
1010
|
-
|
|
1011
1123
|
// HIP-3 candles
|
|
1012
1124
|
ws.replay('hip3_candles', 'km:US500', {
|
|
1013
1125
|
start: Date.now() - 86400000,
|
|
@@ -1062,42 +1174,7 @@ ws.replaySeek(1704067200000);
|
|
|
1062
1174
|
ws.replayStop();
|
|
1063
1175
|
```
|
|
1064
1176
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
Stream multiple channels simultaneously for fast bulk download.
|
|
1068
|
-
|
|
1069
|
-
```typescript
|
|
1070
|
-
const ws = new OxArchiveWs({ apiKey: 'ox_...' });
|
|
1071
|
-
await ws.connect();
|
|
1072
|
-
|
|
1073
|
-
// Handle initial snapshots
|
|
1074
|
-
ws.onReplaySnapshot((channel, coin, timestamp, data) => {
|
|
1075
|
-
console.log(`Initial ${channel} snapshot`);
|
|
1076
|
-
});
|
|
1077
|
-
|
|
1078
|
-
// Handle batched data from all channels
|
|
1079
|
-
ws.onBatch((coin, records) => {
|
|
1080
|
-
for (const record of records) {
|
|
1081
|
-
// Process interleaved data from all channels
|
|
1082
|
-
}
|
|
1083
|
-
});
|
|
1084
|
-
|
|
1085
|
-
ws.onStreamComplete((channel, coin, count) => {
|
|
1086
|
-
console.log(`Stream complete: ${count} records`);
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
|
-
// Start multi-channel stream
|
|
1090
|
-
ws.multiStream(['orderbook', 'trades', 'open_interest', 'funding'], 'ETH', {
|
|
1091
|
-
start: Date.now() - 3600000,
|
|
1092
|
-
end: Date.now(),
|
|
1093
|
-
batchSize: 1000
|
|
1094
|
-
});
|
|
1095
|
-
|
|
1096
|
-
// Stop if needed
|
|
1097
|
-
ws.streamStop();
|
|
1098
|
-
```
|
|
1099
|
-
|
|
1100
|
-
**Channels available for multi-channel mode:** All historical channels can be combined in a single multi-channel replay or stream. This includes `orderbook`, `trades`, `candles`, `liquidations`, `open_interest`, `funding`, and their `lighter_*` and `hip3_*` variants.
|
|
1177
|
+
**Channels available for multi-channel replay:** All historical channels can be combined in a single multi-channel replay. This includes `orderbook`, `trades`, `candles`, `liquidations`, `open_interest`, `funding`, and their `lighter_*` and `hip3_*` variants.
|
|
1101
1178
|
|
|
1102
1179
|
### WebSocket Connection States
|
|
1103
1180
|
|
|
@@ -1112,18 +1189,18 @@ The SDK accepts timestamps as Unix milliseconds or Date objects:
|
|
|
1112
1189
|
|
|
1113
1190
|
```typescript
|
|
1114
1191
|
// Unix milliseconds (recommended)
|
|
1115
|
-
client.orderbook.history('BTC', {
|
|
1192
|
+
client.hyperliquid.orderbook.history('BTC', {
|
|
1116
1193
|
start: Date.now() - 86400000,
|
|
1117
1194
|
end: Date.now()
|
|
1118
1195
|
});
|
|
1119
1196
|
|
|
1120
1197
|
// Date objects (converted automatically)
|
|
1121
|
-
client.orderbook.history('BTC', {
|
|
1198
|
+
client.hyperliquid.orderbook.history('BTC', {
|
|
1122
1199
|
start: new Date('2024-01-01'),
|
|
1123
1200
|
end: new Date('2024-01-02')
|
|
1124
1201
|
});
|
|
1125
1202
|
|
|
1126
|
-
// WebSocket replay
|
|
1203
|
+
// WebSocket replay also accepts both
|
|
1127
1204
|
ws.replay('orderbook', 'BTC', {
|
|
1128
1205
|
start: Date.now() - 3600000,
|
|
1129
1206
|
end: Date.now(),
|
|
@@ -1198,6 +1275,10 @@ const client = new OxArchive({
|
|
|
1198
1275
|
|
|
1199
1276
|
When enabled, responses are validated against Zod schemas and throw `OxArchiveError` with status 422 if validation fails.
|
|
1200
1277
|
|
|
1278
|
+
## Bulk Data Downloads
|
|
1279
|
+
|
|
1280
|
+
For large-scale data exports (full order books, complete trade history, etc.), use the S3 Parquet bulk export available at [0xarchive.io/data](https://0xarchive.io/data). The Data Explorer lets you select time ranges, symbols, and data types, then download compressed Parquet files directly.
|
|
1281
|
+
|
|
1201
1282
|
## Requirements
|
|
1202
1283
|
|
|
1203
1284
|
- Node.js 18+ or modern browsers with `fetch` and `WebSocket` support
|