@0xarchive/sdk 0.7.0 → 0.8.1
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 +68 -0
- package/dist/index.d.mts +112 -12
- package/dist/index.d.ts +112 -12
- package/dist/index.js +94 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +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 (Pro+ only, February 2026+)
|
|
7
8
|
- **Lighter.xyz** - Perpetuals data (August 2025+ for fills, Jan 2026+ for OB, OI, Funding Rate)
|
|
8
9
|
|
|
9
10
|
## Installation
|
|
@@ -31,6 +32,13 @@ console.log(`Hyperliquid BTC mid price: ${hlOrderbook.midPrice}`);
|
|
|
31
32
|
const lighterOrderbook = await client.lighter.orderbook.get('BTC');
|
|
32
33
|
console.log(`Lighter BTC mid price: ${lighterOrderbook.midPrice}`);
|
|
33
34
|
|
|
35
|
+
// HIP-3 builder perps (February 2026+)
|
|
36
|
+
const hip3Instruments = await client.hyperliquid.hip3.instruments.list();
|
|
37
|
+
const hip3Orderbook = await client.hyperliquid.hip3.orderbook.get('km:US500');
|
|
38
|
+
const hip3Trades = await client.hyperliquid.hip3.trades.recent('km:US500');
|
|
39
|
+
const hip3Funding = await client.hyperliquid.hip3.funding.current('xyz:XYZ100');
|
|
40
|
+
const hip3Oi = await client.hyperliquid.hip3.openInterest.current('xyz:XYZ100');
|
|
41
|
+
|
|
34
42
|
// Get historical order book snapshots
|
|
35
43
|
const history = await client.hyperliquid.orderbook.history('ETH', {
|
|
36
44
|
start: Date.now() - 86400000, // 24 hours ago
|
|
@@ -262,6 +270,28 @@ console.log(`ETH min base amount: ${eth.minBaseAmount}`);
|
|
|
262
270
|
| Market ID | Not available | `marketId` |
|
|
263
271
|
| Min amounts | Not available | `minBaseAmount`, `minQuoteAmount` |
|
|
264
272
|
|
|
273
|
+
#### HIP-3 Instruments
|
|
274
|
+
|
|
275
|
+
HIP-3 instruments are derived from live market data and include mark price, open interest, and mid price:
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
// List all HIP-3 instruments (no tier restriction)
|
|
279
|
+
const hip3Instruments = await client.hyperliquid.hip3.instruments.list();
|
|
280
|
+
for (const inst of hip3Instruments) {
|
|
281
|
+
console.log(`${inst.coin} (${inst.namespace}:${inst.ticker}): mark=${inst.markPrice}, OI=${inst.openInterest}`);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Get specific HIP-3 instrument (case-sensitive)
|
|
285
|
+
const us500 = await client.hyperliquid.hip3.instruments.get('km:US500');
|
|
286
|
+
console.log(`Mark price: ${us500.markPrice}`);
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Available HIP-3 Coins:**
|
|
290
|
+
| Builder | Coins |
|
|
291
|
+
|---------|-------|
|
|
292
|
+
| xyz (Hyperliquid) | `xyz:XYZ100` |
|
|
293
|
+
| km (Kinetiq Markets) | `km:US500`, `km:SMALL2000`, `km:GOOGL`, `km:USBOND`, `km:GOLD`, `km:USTECH`, `km:NVDA`, `km:SILVER`, `km:BABA` |
|
|
294
|
+
|
|
265
295
|
### Funding Rates
|
|
266
296
|
|
|
267
297
|
```typescript
|
|
@@ -653,6 +683,8 @@ const ws = new OxArchiveWs({
|
|
|
653
683
|
|
|
654
684
|
### Available Channels
|
|
655
685
|
|
|
686
|
+
#### Hyperliquid Channels
|
|
687
|
+
|
|
656
688
|
| Channel | Description | Requires Coin | Historical Support |
|
|
657
689
|
|---------|-------------|---------------|-------------------|
|
|
658
690
|
| `orderbook` | L2 order book updates | Yes | Yes |
|
|
@@ -662,6 +694,23 @@ const ws = new OxArchiveWs({
|
|
|
662
694
|
| `ticker` | Price and 24h volume | Yes | Real-time only |
|
|
663
695
|
| `all_tickers` | All market tickers | No | Real-time only |
|
|
664
696
|
|
|
697
|
+
#### HIP-3 Builder Perps Channels
|
|
698
|
+
|
|
699
|
+
| Channel | Description | Requires Coin | Historical Support |
|
|
700
|
+
|---------|-------------|---------------|-------------------|
|
|
701
|
+
| `hip3_orderbook` | HIP-3 L2 order book snapshots | Yes | Yes |
|
|
702
|
+
| `hip3_trades` | HIP-3 trade/fill updates | Yes | Yes |
|
|
703
|
+
|
|
704
|
+
> **Note:** HIP-3 coins are case-sensitive (e.g., `km:US500`, `xyz:XYZ100`). Do not uppercase them.
|
|
705
|
+
|
|
706
|
+
#### Lighter.xyz Channels
|
|
707
|
+
|
|
708
|
+
| Channel | Description | Requires Coin | Historical Support |
|
|
709
|
+
|---------|-------------|---------------|-------------------|
|
|
710
|
+
| `lighter_orderbook` | Lighter L2 order book (reconstructed) | Yes | Yes |
|
|
711
|
+
| `lighter_trades` | Lighter trade/fill updates | Yes | Yes |
|
|
712
|
+
| `lighter_candles` | Lighter OHLCV candle data | Yes | Yes |
|
|
713
|
+
|
|
665
714
|
#### Candle Replay/Stream
|
|
666
715
|
|
|
667
716
|
```typescript
|
|
@@ -689,6 +738,24 @@ ws.replay('lighter_candles', 'BTC', {
|
|
|
689
738
|
});
|
|
690
739
|
```
|
|
691
740
|
|
|
741
|
+
#### HIP-3 Replay/Stream
|
|
742
|
+
|
|
743
|
+
```typescript
|
|
744
|
+
// Replay HIP-3 orderbook at 50x speed
|
|
745
|
+
ws.replay('hip3_orderbook', 'km:US500', {
|
|
746
|
+
start: Date.now() - 3600000,
|
|
747
|
+
end: Date.now(),
|
|
748
|
+
speed: 50,
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
// Bulk stream HIP-3 trades
|
|
752
|
+
ws.stream('hip3_trades', 'xyz:XYZ100', {
|
|
753
|
+
start: Date.now() - 86400000,
|
|
754
|
+
end: Date.now(),
|
|
755
|
+
batchSize: 1000,
|
|
756
|
+
});
|
|
757
|
+
```
|
|
758
|
+
|
|
692
759
|
### WebSocket Connection States
|
|
693
760
|
|
|
694
761
|
```typescript
|
|
@@ -749,6 +816,7 @@ import type {
|
|
|
749
816
|
Candle,
|
|
750
817
|
Instrument,
|
|
751
818
|
LighterInstrument,
|
|
819
|
+
Hip3Instrument,
|
|
752
820
|
LighterGranularity,
|
|
753
821
|
FundingRate,
|
|
754
822
|
OpenInterest,
|
package/dist/index.d.mts
CHANGED
|
@@ -216,6 +216,26 @@ interface LighterInstrument {
|
|
|
216
216
|
/** Whether the instrument is currently tradeable */
|
|
217
217
|
isActive: boolean;
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* HIP-3 Builder Perps instrument with latest market data.
|
|
221
|
+
* Derived from live open interest data.
|
|
222
|
+
*/
|
|
223
|
+
interface Hip3Instrument {
|
|
224
|
+
/** Full coin name (e.g., km:US500, xyz:XYZ100) */
|
|
225
|
+
coin: string;
|
|
226
|
+
/** Builder namespace (e.g., km, xyz) */
|
|
227
|
+
namespace: string;
|
|
228
|
+
/** Ticker within the namespace (e.g., US500, XYZ100) */
|
|
229
|
+
ticker: string;
|
|
230
|
+
/** Latest mark price */
|
|
231
|
+
markPrice?: number;
|
|
232
|
+
/** Latest open interest */
|
|
233
|
+
openInterest?: number;
|
|
234
|
+
/** Latest mid price */
|
|
235
|
+
midPrice?: number;
|
|
236
|
+
/** Timestamp of latest data point */
|
|
237
|
+
latestTimestamp?: string;
|
|
238
|
+
}
|
|
219
239
|
/**
|
|
220
240
|
* Funding rate record
|
|
221
241
|
*/
|
|
@@ -336,7 +356,7 @@ interface CandleHistoryParams extends CursorPaginationParams {
|
|
|
336
356
|
interval?: CandleInterval;
|
|
337
357
|
}
|
|
338
358
|
/** WebSocket channel types. Note: ticker/all_tickers are real-time only. Liquidations is historical only (May 2025+). */
|
|
339
|
-
type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers';
|
|
359
|
+
type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers' | 'lighter_orderbook' | 'lighter_trades' | 'lighter_candles' | 'hip3_orderbook' | 'hip3_trades';
|
|
340
360
|
/** Subscribe message from client */
|
|
341
361
|
interface WsSubscribe {
|
|
342
362
|
op: 'subscribe';
|
|
@@ -1095,7 +1115,8 @@ interface TickHistoryParams {
|
|
|
1095
1115
|
declare class OrderBookResource {
|
|
1096
1116
|
private http;
|
|
1097
1117
|
private basePath;
|
|
1098
|
-
|
|
1118
|
+
private coinTransform;
|
|
1119
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1099
1120
|
/**
|
|
1100
1121
|
* Get order book snapshot for a coin
|
|
1101
1122
|
*
|
|
@@ -1287,7 +1308,8 @@ declare class OrderBookResource {
|
|
|
1287
1308
|
declare class TradesResource {
|
|
1288
1309
|
private http;
|
|
1289
1310
|
private basePath;
|
|
1290
|
-
|
|
1311
|
+
private coinTransform;
|
|
1312
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1291
1313
|
/**
|
|
1292
1314
|
* Get trade history for a coin using cursor-based pagination
|
|
1293
1315
|
*
|
|
@@ -1322,9 +1344,10 @@ declare class TradesResource {
|
|
|
1322
1344
|
/**
|
|
1323
1345
|
* Get most recent trades for a coin.
|
|
1324
1346
|
*
|
|
1325
|
-
* Note: This method is
|
|
1326
|
-
* which
|
|
1327
|
-
* endpoint is not available
|
|
1347
|
+
* Note: This method is available for Lighter (client.lighter.trades.recent())
|
|
1348
|
+
* and HIP-3 (client.hyperliquid.hip3.trades.recent()) which have real-time data
|
|
1349
|
+
* ingestion. Hyperliquid uses hourly backfill so this endpoint is not available
|
|
1350
|
+
* for Hyperliquid.
|
|
1328
1351
|
*
|
|
1329
1352
|
* @param coin - The coin symbol (e.g., 'BTC', 'ETH')
|
|
1330
1353
|
* @param limit - Number of trades to return (default: 100)
|
|
@@ -1397,6 +1420,41 @@ declare class LighterInstrumentsResource {
|
|
|
1397
1420
|
*/
|
|
1398
1421
|
get(coin: string): Promise<LighterInstrument>;
|
|
1399
1422
|
}
|
|
1423
|
+
/**
|
|
1424
|
+
* HIP-3 Builder Perps Instruments API resource
|
|
1425
|
+
*
|
|
1426
|
+
* HIP-3 instruments are derived from live market data and include
|
|
1427
|
+
* mark price, open interest, and mid price context.
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```typescript
|
|
1431
|
+
* // List all HIP-3 instruments
|
|
1432
|
+
* const instruments = await client.hyperliquid.hip3.instruments.list();
|
|
1433
|
+
*
|
|
1434
|
+
* // Get specific instrument
|
|
1435
|
+
* const us500 = await client.hyperliquid.hip3.instruments.get('km:US500');
|
|
1436
|
+
* console.log(`Mark price: ${us500.markPrice}`);
|
|
1437
|
+
* ```
|
|
1438
|
+
*/
|
|
1439
|
+
declare class Hip3InstrumentsResource {
|
|
1440
|
+
private http;
|
|
1441
|
+
private basePath;
|
|
1442
|
+
private coinTransform;
|
|
1443
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (c: string) => string);
|
|
1444
|
+
/**
|
|
1445
|
+
* List all available HIP-3 instruments with latest market data
|
|
1446
|
+
*
|
|
1447
|
+
* @returns Array of HIP-3 instruments
|
|
1448
|
+
*/
|
|
1449
|
+
list(): Promise<Hip3Instrument[]>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Get a specific HIP-3 instrument by coin name
|
|
1452
|
+
*
|
|
1453
|
+
* @param coin - The coin name (e.g., 'km:US500', 'xyz:XYZ100'). Case-sensitive.
|
|
1454
|
+
* @returns HIP-3 instrument details with latest market data
|
|
1455
|
+
*/
|
|
1456
|
+
get(coin: string): Promise<Hip3Instrument>;
|
|
1457
|
+
}
|
|
1400
1458
|
|
|
1401
1459
|
/**
|
|
1402
1460
|
* Funding rates API resource
|
|
@@ -1429,7 +1487,8 @@ declare class LighterInstrumentsResource {
|
|
|
1429
1487
|
declare class FundingResource {
|
|
1430
1488
|
private http;
|
|
1431
1489
|
private basePath;
|
|
1432
|
-
|
|
1490
|
+
private coinTransform;
|
|
1491
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1433
1492
|
/**
|
|
1434
1493
|
* Get funding rate history for a coin with cursor-based pagination
|
|
1435
1494
|
*
|
|
@@ -1478,7 +1537,8 @@ declare class FundingResource {
|
|
|
1478
1537
|
declare class OpenInterestResource {
|
|
1479
1538
|
private http;
|
|
1480
1539
|
private basePath;
|
|
1481
|
-
|
|
1540
|
+
private coinTransform;
|
|
1541
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1482
1542
|
/**
|
|
1483
1543
|
* Get open interest history for a coin with cursor-based pagination
|
|
1484
1544
|
*
|
|
@@ -1665,7 +1725,7 @@ declare class DataQualityResource {
|
|
|
1665
1725
|
/**
|
|
1666
1726
|
* Get data coverage for a specific exchange
|
|
1667
1727
|
*
|
|
1668
|
-
* @param exchange - Exchange name ('hyperliquid' or '
|
|
1728
|
+
* @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
|
|
1669
1729
|
* @returns ExchangeCoverage with coverage info for all data types on this exchange
|
|
1670
1730
|
*
|
|
1671
1731
|
* @example
|
|
@@ -1681,8 +1741,8 @@ declare class DataQualityResource {
|
|
|
1681
1741
|
* Includes gap detection, empirical data cadence, and hour-level historical coverage.
|
|
1682
1742
|
* Supports optional time bounds for gap detection (default: last 30 days).
|
|
1683
1743
|
*
|
|
1684
|
-
* @param exchange - Exchange name ('hyperliquid' or '
|
|
1685
|
-
* @param symbol - Symbol name (e.g., 'BTC', 'ETH')
|
|
1744
|
+
* @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
|
|
1745
|
+
* @param symbol - Symbol name (e.g., 'BTC', 'ETH', or HIP3 coins like 'xyz:XYZ100')
|
|
1686
1746
|
* @param options - Optional time bounds for gap detection window
|
|
1687
1747
|
* @returns SymbolCoverageResponse with per-data-type coverage including gaps, cadence, and historical coverage
|
|
1688
1748
|
*
|
|
@@ -1817,6 +1877,46 @@ declare class HyperliquidClient {
|
|
|
1817
1877
|
* Liquidation events (May 2025+)
|
|
1818
1878
|
*/
|
|
1819
1879
|
readonly liquidations: LiquidationsResource;
|
|
1880
|
+
/**
|
|
1881
|
+
* HIP-3 builder-deployed perpetuals (Pro+ only, February 2026+)
|
|
1882
|
+
*/
|
|
1883
|
+
readonly hip3: Hip3Client;
|
|
1884
|
+
constructor(http: HttpClient);
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* HIP-3 builder-deployed perpetuals client
|
|
1888
|
+
*
|
|
1889
|
+
* Access Hyperliquid HIP-3 builder perps data through the 0xarchive API.
|
|
1890
|
+
* Requires Pro tier or higher.
|
|
1891
|
+
*
|
|
1892
|
+
* @example
|
|
1893
|
+
* ```typescript
|
|
1894
|
+
* const client = new OxArchive({ apiKey: '...' });
|
|
1895
|
+
* const orderbook = await client.hyperliquid.hip3.orderbook.get('xyz:XYZ100');
|
|
1896
|
+
* const trades = await client.hyperliquid.hip3.trades.recent('xyz:XYZ100');
|
|
1897
|
+
* ```
|
|
1898
|
+
*/
|
|
1899
|
+
declare class Hip3Client {
|
|
1900
|
+
/**
|
|
1901
|
+
* HIP-3 instruments with latest market data
|
|
1902
|
+
*/
|
|
1903
|
+
readonly instruments: Hip3InstrumentsResource;
|
|
1904
|
+
/**
|
|
1905
|
+
* Order book snapshots (February 2026+)
|
|
1906
|
+
*/
|
|
1907
|
+
readonly orderbook: OrderBookResource;
|
|
1908
|
+
/**
|
|
1909
|
+
* Trade/fill history
|
|
1910
|
+
*/
|
|
1911
|
+
readonly trades: TradesResource;
|
|
1912
|
+
/**
|
|
1913
|
+
* Funding rates
|
|
1914
|
+
*/
|
|
1915
|
+
readonly funding: FundingResource;
|
|
1916
|
+
/**
|
|
1917
|
+
* Open interest
|
|
1918
|
+
*/
|
|
1919
|
+
readonly openInterest: OpenInterestResource;
|
|
1820
1920
|
constructor(http: HttpClient);
|
|
1821
1921
|
}
|
|
1822
1922
|
/**
|
|
@@ -4029,4 +4129,4 @@ type ValidatedCandle = z.infer<typeof CandleSchema>;
|
|
|
4029
4129
|
type ValidatedLiquidation = z.infer<typeof LiquidationSchema>;
|
|
4030
4130
|
type ValidatedWsServerMessage = z.infer<typeof WsServerMessageSchema>;
|
|
4031
4131
|
|
|
4032
|
-
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type Candle, CandleArrayResponseSchema, type CandleHistoryParams, type CandleInterval, CandleIntervalSchema, CandleSchema, type ClientOptions, type CompletenessMetrics, type CoverageGap, type CoverageResponse, type CursorResponse, type DataCadence, type DataFreshness, type DataTypeCoverage, type DataTypeStatus, type ExchangeCoverage, type ExchangeLatency, type ExchangeStatus, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, HyperliquidClient, type Incident, type IncidentSeverityValue, type IncidentStatusValue, type IncidentsResponse, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, type LatencyResponse, LighterClient, type LighterGranularity, type LighterInstrument, type Liquidation, LiquidationArrayResponseSchema, type LiquidationHistoryParams, LiquidationSchema, LiquidationSideSchema, type LiquidationsByUserParams, type ListIncidentsParams, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookReconstructor, OrderBookResponseSchema, OrderBookSchema, type OrderbookDelta, OxArchive, OxArchiveError, OxArchiveWs, type Pagination, type PriceLevel, PriceLevelSchema, type ReconstructOptions, type ReconstructedOrderBook, type RestApiLatency, type SlaActual, type SlaParams, type SlaResponse, type SlaTargets, type StatusResponse, type SymbolCoverageOptions, type SymbolCoverageResponse, type SymbolDataTypeCoverage, type SystemStatusValue, type TickData, type TickHistoryParams, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedCandle, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedLiquidation, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WebSocketLatency, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, type WsHistoricalTickData, type WsOptions, type WsPing, type WsPong, WsPongSchema, type WsReplay, type WsReplayCompleted, WsReplayCompletedSchema, type WsReplayPause, type WsReplayPaused, WsReplayPausedSchema, type WsReplayResume, type WsReplayResumed, WsReplayResumedSchema, type WsReplaySeek, type WsReplayStarted, WsReplayStartedSchema, type WsReplayStop, type WsReplayStopped, WsReplayStoppedSchema, type WsServerMessage, WsServerMessageSchema, type WsStream, type WsStreamCompleted, WsStreamCompletedSchema, type WsStreamProgress, WsStreamProgressSchema, type WsStreamStarted, WsStreamStartedSchema, type WsStreamStop, type WsStreamStopped, WsStreamStoppedSchema, type WsSubscribe, type WsSubscribed, WsSubscribedSchema, type WsUnsubscribe, type WsUnsubscribed, WsUnsubscribedSchema, OxArchive as default, reconstructFinal, reconstructOrderBook };
|
|
4132
|
+
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type Candle, CandleArrayResponseSchema, type CandleHistoryParams, type CandleInterval, CandleIntervalSchema, CandleSchema, type ClientOptions, type CompletenessMetrics, type CoverageGap, type CoverageResponse, type CursorResponse, type DataCadence, type DataFreshness, type DataTypeCoverage, type DataTypeStatus, type ExchangeCoverage, type ExchangeLatency, type ExchangeStatus, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, Hip3Client, type Hip3Instrument, HyperliquidClient, type Incident, type IncidentSeverityValue, type IncidentStatusValue, type IncidentsResponse, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, type LatencyResponse, LighterClient, type LighterGranularity, type LighterInstrument, type Liquidation, LiquidationArrayResponseSchema, type LiquidationHistoryParams, LiquidationSchema, LiquidationSideSchema, type LiquidationsByUserParams, type ListIncidentsParams, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookReconstructor, OrderBookResponseSchema, OrderBookSchema, type OrderbookDelta, OxArchive, OxArchiveError, OxArchiveWs, type Pagination, type PriceLevel, PriceLevelSchema, type ReconstructOptions, type ReconstructedOrderBook, type RestApiLatency, type SlaActual, type SlaParams, type SlaResponse, type SlaTargets, type StatusResponse, type SymbolCoverageOptions, type SymbolCoverageResponse, type SymbolDataTypeCoverage, type SystemStatusValue, type TickData, type TickHistoryParams, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedCandle, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedLiquidation, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WebSocketLatency, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, type WsHistoricalTickData, type WsOptions, type WsPing, type WsPong, WsPongSchema, type WsReplay, type WsReplayCompleted, WsReplayCompletedSchema, type WsReplayPause, type WsReplayPaused, WsReplayPausedSchema, type WsReplayResume, type WsReplayResumed, WsReplayResumedSchema, type WsReplaySeek, type WsReplayStarted, WsReplayStartedSchema, type WsReplayStop, type WsReplayStopped, WsReplayStoppedSchema, type WsServerMessage, WsServerMessageSchema, type WsStream, type WsStreamCompleted, WsStreamCompletedSchema, type WsStreamProgress, WsStreamProgressSchema, type WsStreamStarted, WsStreamStartedSchema, type WsStreamStop, type WsStreamStopped, WsStreamStoppedSchema, type WsSubscribe, type WsSubscribed, WsSubscribedSchema, type WsUnsubscribe, type WsUnsubscribed, WsUnsubscribedSchema, OxArchive as default, reconstructFinal, reconstructOrderBook };
|
package/dist/index.d.ts
CHANGED
|
@@ -216,6 +216,26 @@ interface LighterInstrument {
|
|
|
216
216
|
/** Whether the instrument is currently tradeable */
|
|
217
217
|
isActive: boolean;
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* HIP-3 Builder Perps instrument with latest market data.
|
|
221
|
+
* Derived from live open interest data.
|
|
222
|
+
*/
|
|
223
|
+
interface Hip3Instrument {
|
|
224
|
+
/** Full coin name (e.g., km:US500, xyz:XYZ100) */
|
|
225
|
+
coin: string;
|
|
226
|
+
/** Builder namespace (e.g., km, xyz) */
|
|
227
|
+
namespace: string;
|
|
228
|
+
/** Ticker within the namespace (e.g., US500, XYZ100) */
|
|
229
|
+
ticker: string;
|
|
230
|
+
/** Latest mark price */
|
|
231
|
+
markPrice?: number;
|
|
232
|
+
/** Latest open interest */
|
|
233
|
+
openInterest?: number;
|
|
234
|
+
/** Latest mid price */
|
|
235
|
+
midPrice?: number;
|
|
236
|
+
/** Timestamp of latest data point */
|
|
237
|
+
latestTimestamp?: string;
|
|
238
|
+
}
|
|
219
239
|
/**
|
|
220
240
|
* Funding rate record
|
|
221
241
|
*/
|
|
@@ -336,7 +356,7 @@ interface CandleHistoryParams extends CursorPaginationParams {
|
|
|
336
356
|
interval?: CandleInterval;
|
|
337
357
|
}
|
|
338
358
|
/** WebSocket channel types. Note: ticker/all_tickers are real-time only. Liquidations is historical only (May 2025+). */
|
|
339
|
-
type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers';
|
|
359
|
+
type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers' | 'lighter_orderbook' | 'lighter_trades' | 'lighter_candles' | 'hip3_orderbook' | 'hip3_trades';
|
|
340
360
|
/** Subscribe message from client */
|
|
341
361
|
interface WsSubscribe {
|
|
342
362
|
op: 'subscribe';
|
|
@@ -1095,7 +1115,8 @@ interface TickHistoryParams {
|
|
|
1095
1115
|
declare class OrderBookResource {
|
|
1096
1116
|
private http;
|
|
1097
1117
|
private basePath;
|
|
1098
|
-
|
|
1118
|
+
private coinTransform;
|
|
1119
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1099
1120
|
/**
|
|
1100
1121
|
* Get order book snapshot for a coin
|
|
1101
1122
|
*
|
|
@@ -1287,7 +1308,8 @@ declare class OrderBookResource {
|
|
|
1287
1308
|
declare class TradesResource {
|
|
1288
1309
|
private http;
|
|
1289
1310
|
private basePath;
|
|
1290
|
-
|
|
1311
|
+
private coinTransform;
|
|
1312
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1291
1313
|
/**
|
|
1292
1314
|
* Get trade history for a coin using cursor-based pagination
|
|
1293
1315
|
*
|
|
@@ -1322,9 +1344,10 @@ declare class TradesResource {
|
|
|
1322
1344
|
/**
|
|
1323
1345
|
* Get most recent trades for a coin.
|
|
1324
1346
|
*
|
|
1325
|
-
* Note: This method is
|
|
1326
|
-
* which
|
|
1327
|
-
* endpoint is not available
|
|
1347
|
+
* Note: This method is available for Lighter (client.lighter.trades.recent())
|
|
1348
|
+
* and HIP-3 (client.hyperliquid.hip3.trades.recent()) which have real-time data
|
|
1349
|
+
* ingestion. Hyperliquid uses hourly backfill so this endpoint is not available
|
|
1350
|
+
* for Hyperliquid.
|
|
1328
1351
|
*
|
|
1329
1352
|
* @param coin - The coin symbol (e.g., 'BTC', 'ETH')
|
|
1330
1353
|
* @param limit - Number of trades to return (default: 100)
|
|
@@ -1397,6 +1420,41 @@ declare class LighterInstrumentsResource {
|
|
|
1397
1420
|
*/
|
|
1398
1421
|
get(coin: string): Promise<LighterInstrument>;
|
|
1399
1422
|
}
|
|
1423
|
+
/**
|
|
1424
|
+
* HIP-3 Builder Perps Instruments API resource
|
|
1425
|
+
*
|
|
1426
|
+
* HIP-3 instruments are derived from live market data and include
|
|
1427
|
+
* mark price, open interest, and mid price context.
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```typescript
|
|
1431
|
+
* // List all HIP-3 instruments
|
|
1432
|
+
* const instruments = await client.hyperliquid.hip3.instruments.list();
|
|
1433
|
+
*
|
|
1434
|
+
* // Get specific instrument
|
|
1435
|
+
* const us500 = await client.hyperliquid.hip3.instruments.get('km:US500');
|
|
1436
|
+
* console.log(`Mark price: ${us500.markPrice}`);
|
|
1437
|
+
* ```
|
|
1438
|
+
*/
|
|
1439
|
+
declare class Hip3InstrumentsResource {
|
|
1440
|
+
private http;
|
|
1441
|
+
private basePath;
|
|
1442
|
+
private coinTransform;
|
|
1443
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (c: string) => string);
|
|
1444
|
+
/**
|
|
1445
|
+
* List all available HIP-3 instruments with latest market data
|
|
1446
|
+
*
|
|
1447
|
+
* @returns Array of HIP-3 instruments
|
|
1448
|
+
*/
|
|
1449
|
+
list(): Promise<Hip3Instrument[]>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Get a specific HIP-3 instrument by coin name
|
|
1452
|
+
*
|
|
1453
|
+
* @param coin - The coin name (e.g., 'km:US500', 'xyz:XYZ100'). Case-sensitive.
|
|
1454
|
+
* @returns HIP-3 instrument details with latest market data
|
|
1455
|
+
*/
|
|
1456
|
+
get(coin: string): Promise<Hip3Instrument>;
|
|
1457
|
+
}
|
|
1400
1458
|
|
|
1401
1459
|
/**
|
|
1402
1460
|
* Funding rates API resource
|
|
@@ -1429,7 +1487,8 @@ declare class LighterInstrumentsResource {
|
|
|
1429
1487
|
declare class FundingResource {
|
|
1430
1488
|
private http;
|
|
1431
1489
|
private basePath;
|
|
1432
|
-
|
|
1490
|
+
private coinTransform;
|
|
1491
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1433
1492
|
/**
|
|
1434
1493
|
* Get funding rate history for a coin with cursor-based pagination
|
|
1435
1494
|
*
|
|
@@ -1478,7 +1537,8 @@ declare class FundingResource {
|
|
|
1478
1537
|
declare class OpenInterestResource {
|
|
1479
1538
|
private http;
|
|
1480
1539
|
private basePath;
|
|
1481
|
-
|
|
1540
|
+
private coinTransform;
|
|
1541
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1482
1542
|
/**
|
|
1483
1543
|
* Get open interest history for a coin with cursor-based pagination
|
|
1484
1544
|
*
|
|
@@ -1665,7 +1725,7 @@ declare class DataQualityResource {
|
|
|
1665
1725
|
/**
|
|
1666
1726
|
* Get data coverage for a specific exchange
|
|
1667
1727
|
*
|
|
1668
|
-
* @param exchange - Exchange name ('hyperliquid' or '
|
|
1728
|
+
* @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
|
|
1669
1729
|
* @returns ExchangeCoverage with coverage info for all data types on this exchange
|
|
1670
1730
|
*
|
|
1671
1731
|
* @example
|
|
@@ -1681,8 +1741,8 @@ declare class DataQualityResource {
|
|
|
1681
1741
|
* Includes gap detection, empirical data cadence, and hour-level historical coverage.
|
|
1682
1742
|
* Supports optional time bounds for gap detection (default: last 30 days).
|
|
1683
1743
|
*
|
|
1684
|
-
* @param exchange - Exchange name ('hyperliquid' or '
|
|
1685
|
-
* @param symbol - Symbol name (e.g., 'BTC', 'ETH')
|
|
1744
|
+
* @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
|
|
1745
|
+
* @param symbol - Symbol name (e.g., 'BTC', 'ETH', or HIP3 coins like 'xyz:XYZ100')
|
|
1686
1746
|
* @param options - Optional time bounds for gap detection window
|
|
1687
1747
|
* @returns SymbolCoverageResponse with per-data-type coverage including gaps, cadence, and historical coverage
|
|
1688
1748
|
*
|
|
@@ -1817,6 +1877,46 @@ declare class HyperliquidClient {
|
|
|
1817
1877
|
* Liquidation events (May 2025+)
|
|
1818
1878
|
*/
|
|
1819
1879
|
readonly liquidations: LiquidationsResource;
|
|
1880
|
+
/**
|
|
1881
|
+
* HIP-3 builder-deployed perpetuals (Pro+ only, February 2026+)
|
|
1882
|
+
*/
|
|
1883
|
+
readonly hip3: Hip3Client;
|
|
1884
|
+
constructor(http: HttpClient);
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* HIP-3 builder-deployed perpetuals client
|
|
1888
|
+
*
|
|
1889
|
+
* Access Hyperliquid HIP-3 builder perps data through the 0xarchive API.
|
|
1890
|
+
* Requires Pro tier or higher.
|
|
1891
|
+
*
|
|
1892
|
+
* @example
|
|
1893
|
+
* ```typescript
|
|
1894
|
+
* const client = new OxArchive({ apiKey: '...' });
|
|
1895
|
+
* const orderbook = await client.hyperliquid.hip3.orderbook.get('xyz:XYZ100');
|
|
1896
|
+
* const trades = await client.hyperliquid.hip3.trades.recent('xyz:XYZ100');
|
|
1897
|
+
* ```
|
|
1898
|
+
*/
|
|
1899
|
+
declare class Hip3Client {
|
|
1900
|
+
/**
|
|
1901
|
+
* HIP-3 instruments with latest market data
|
|
1902
|
+
*/
|
|
1903
|
+
readonly instruments: Hip3InstrumentsResource;
|
|
1904
|
+
/**
|
|
1905
|
+
* Order book snapshots (February 2026+)
|
|
1906
|
+
*/
|
|
1907
|
+
readonly orderbook: OrderBookResource;
|
|
1908
|
+
/**
|
|
1909
|
+
* Trade/fill history
|
|
1910
|
+
*/
|
|
1911
|
+
readonly trades: TradesResource;
|
|
1912
|
+
/**
|
|
1913
|
+
* Funding rates
|
|
1914
|
+
*/
|
|
1915
|
+
readonly funding: FundingResource;
|
|
1916
|
+
/**
|
|
1917
|
+
* Open interest
|
|
1918
|
+
*/
|
|
1919
|
+
readonly openInterest: OpenInterestResource;
|
|
1820
1920
|
constructor(http: HttpClient);
|
|
1821
1921
|
}
|
|
1822
1922
|
/**
|
|
@@ -4029,4 +4129,4 @@ type ValidatedCandle = z.infer<typeof CandleSchema>;
|
|
|
4029
4129
|
type ValidatedLiquidation = z.infer<typeof LiquidationSchema>;
|
|
4030
4130
|
type ValidatedWsServerMessage = z.infer<typeof WsServerMessageSchema>;
|
|
4031
4131
|
|
|
4032
|
-
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type Candle, CandleArrayResponseSchema, type CandleHistoryParams, type CandleInterval, CandleIntervalSchema, CandleSchema, type ClientOptions, type CompletenessMetrics, type CoverageGap, type CoverageResponse, type CursorResponse, type DataCadence, type DataFreshness, type DataTypeCoverage, type DataTypeStatus, type ExchangeCoverage, type ExchangeLatency, type ExchangeStatus, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, HyperliquidClient, type Incident, type IncidentSeverityValue, type IncidentStatusValue, type IncidentsResponse, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, type LatencyResponse, LighterClient, type LighterGranularity, type LighterInstrument, type Liquidation, LiquidationArrayResponseSchema, type LiquidationHistoryParams, LiquidationSchema, LiquidationSideSchema, type LiquidationsByUserParams, type ListIncidentsParams, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookReconstructor, OrderBookResponseSchema, OrderBookSchema, type OrderbookDelta, OxArchive, OxArchiveError, OxArchiveWs, type Pagination, type PriceLevel, PriceLevelSchema, type ReconstructOptions, type ReconstructedOrderBook, type RestApiLatency, type SlaActual, type SlaParams, type SlaResponse, type SlaTargets, type StatusResponse, type SymbolCoverageOptions, type SymbolCoverageResponse, type SymbolDataTypeCoverage, type SystemStatusValue, type TickData, type TickHistoryParams, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedCandle, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedLiquidation, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WebSocketLatency, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, type WsHistoricalTickData, type WsOptions, type WsPing, type WsPong, WsPongSchema, type WsReplay, type WsReplayCompleted, WsReplayCompletedSchema, type WsReplayPause, type WsReplayPaused, WsReplayPausedSchema, type WsReplayResume, type WsReplayResumed, WsReplayResumedSchema, type WsReplaySeek, type WsReplayStarted, WsReplayStartedSchema, type WsReplayStop, type WsReplayStopped, WsReplayStoppedSchema, type WsServerMessage, WsServerMessageSchema, type WsStream, type WsStreamCompleted, WsStreamCompletedSchema, type WsStreamProgress, WsStreamProgressSchema, type WsStreamStarted, WsStreamStartedSchema, type WsStreamStop, type WsStreamStopped, WsStreamStoppedSchema, type WsSubscribe, type WsSubscribed, WsSubscribedSchema, type WsUnsubscribe, type WsUnsubscribed, WsUnsubscribedSchema, OxArchive as default, reconstructFinal, reconstructOrderBook };
|
|
4132
|
+
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type Candle, CandleArrayResponseSchema, type CandleHistoryParams, type CandleInterval, CandleIntervalSchema, CandleSchema, type ClientOptions, type CompletenessMetrics, type CoverageGap, type CoverageResponse, type CursorResponse, type DataCadence, type DataFreshness, type DataTypeCoverage, type DataTypeStatus, type ExchangeCoverage, type ExchangeLatency, type ExchangeStatus, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, Hip3Client, type Hip3Instrument, HyperliquidClient, type Incident, type IncidentSeverityValue, type IncidentStatusValue, type IncidentsResponse, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, type LatencyResponse, LighterClient, type LighterGranularity, type LighterInstrument, type Liquidation, LiquidationArrayResponseSchema, type LiquidationHistoryParams, LiquidationSchema, LiquidationSideSchema, type LiquidationsByUserParams, type ListIncidentsParams, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookReconstructor, OrderBookResponseSchema, OrderBookSchema, type OrderbookDelta, OxArchive, OxArchiveError, OxArchiveWs, type Pagination, type PriceLevel, PriceLevelSchema, type ReconstructOptions, type ReconstructedOrderBook, type RestApiLatency, type SlaActual, type SlaParams, type SlaResponse, type SlaTargets, type StatusResponse, type SymbolCoverageOptions, type SymbolCoverageResponse, type SymbolDataTypeCoverage, type SystemStatusValue, type TickData, type TickHistoryParams, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedCandle, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedLiquidation, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WebSocketLatency, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, type WsHistoricalTickData, type WsOptions, type WsPing, type WsPong, WsPongSchema, type WsReplay, type WsReplayCompleted, WsReplayCompletedSchema, type WsReplayPause, type WsReplayPaused, WsReplayPausedSchema, type WsReplayResume, type WsReplayResumed, WsReplayResumedSchema, type WsReplaySeek, type WsReplayStarted, WsReplayStartedSchema, type WsReplayStop, type WsReplayStopped, WsReplayStoppedSchema, type WsServerMessage, WsServerMessageSchema, type WsStream, type WsStreamCompleted, WsStreamCompletedSchema, type WsStreamProgress, WsStreamProgressSchema, type WsStreamStarted, WsStreamStartedSchema, type WsStreamStop, type WsStreamStopped, WsStreamStoppedSchema, type WsSubscribe, type WsSubscribed, WsSubscribedSchema, type WsUnsubscribe, type WsUnsubscribed, WsUnsubscribedSchema, OxArchive as default, reconstructFinal, reconstructOrderBook };
|