@0xarchive/sdk 0.6.5 → 0.8.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 +31 -1
- package/dist/index.d.mts +91 -16
- package/dist/index.d.ts +91 -16
- package/dist/index.js +76 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -23
- 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,12 @@ 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 (Pro+ only, February 2026+)
|
|
36
|
+
const hip3Orderbook = await client.hyperliquid.hip3.orderbook.get('xyz:XYZ100');
|
|
37
|
+
const hip3Trades = await client.hyperliquid.hip3.trades.recent('xyz:XYZ100');
|
|
38
|
+
const hip3Funding = await client.hyperliquid.hip3.funding.current('xyz:XYZ100');
|
|
39
|
+
const hip3Oi = await client.hyperliquid.hip3.openInterest.current('xyz:XYZ100');
|
|
40
|
+
|
|
34
41
|
// Get historical order book snapshots
|
|
35
42
|
const history = await client.hyperliquid.orderbook.history('ETH', {
|
|
36
43
|
start: Date.now() - 86400000, // 24 hours ago
|
|
@@ -404,11 +411,25 @@ for (const exchange of coverage.exchanges) {
|
|
|
404
411
|
const btc = await client.dataQuality.symbolCoverage('hyperliquid', 'BTC');
|
|
405
412
|
const oi = btc.dataTypes.open_interest;
|
|
406
413
|
console.log(`BTC OI completeness: ${oi.completeness}%`);
|
|
414
|
+
console.log(`Historical coverage: ${oi.historicalCoverage}%`); // Hour-level granularity
|
|
407
415
|
console.log(`Gaps found: ${oi.gaps.length}`);
|
|
408
416
|
for (const gap of oi.gaps.slice(0, 5)) {
|
|
409
417
|
console.log(` ${gap.durationMinutes} min gap: ${gap.start} -> ${gap.end}`);
|
|
410
418
|
}
|
|
411
419
|
|
|
420
|
+
// Check empirical data cadence (when available)
|
|
421
|
+
const ob = btc.dataTypes.orderbook;
|
|
422
|
+
if (ob.cadence) {
|
|
423
|
+
console.log(`Orderbook cadence: ~${ob.cadence.medianIntervalSeconds}s median, p95=${ob.cadence.p95IntervalSeconds}s`);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Time-bounded gap detection (last 7 days)
|
|
427
|
+
const weekAgo = Date.now() - 7 * 24 * 60 * 60 * 1000;
|
|
428
|
+
const btc7d = await client.dataQuality.symbolCoverage('hyperliquid', 'BTC', {
|
|
429
|
+
from: weekAgo,
|
|
430
|
+
to: Date.now(),
|
|
431
|
+
});
|
|
432
|
+
|
|
412
433
|
// List incidents with filtering
|
|
413
434
|
const result = await client.dataQuality.listIncidents({ status: 'open' });
|
|
414
435
|
for (const incident of result.incidents) {
|
|
@@ -435,12 +456,21 @@ console.log(`API P99: ${sla.actual.apiLatencyP99Ms}ms (${sla.actual.latencyStatu
|
|
|
435
456
|
| `status()` | Overall system health and per-exchange status |
|
|
436
457
|
| `coverage()` | Data coverage summary for all exchanges |
|
|
437
458
|
| `exchangeCoverage(exchange)` | Coverage details for a specific exchange |
|
|
438
|
-
| `symbolCoverage(exchange, symbol)` | Coverage with gap detection
|
|
459
|
+
| `symbolCoverage(exchange, symbol, options?)` | Coverage with gap detection, cadence, and historical coverage |
|
|
439
460
|
| `listIncidents(params)` | List incidents with filtering and pagination |
|
|
440
461
|
| `getIncident(incidentId)` | Get specific incident details |
|
|
441
462
|
| `latency()` | Current latency metrics (WebSocket, REST, data freshness) |
|
|
442
463
|
| `sla(params)` | SLA compliance metrics for a specific month |
|
|
443
464
|
|
|
465
|
+
**Note:** Data Quality endpoints (`coverage()`, `exchangeCoverage()`, `symbolCoverage()`) perform complex aggregation queries and may take 30-60 seconds on first request (results are cached server-side for 5 minutes). If you encounter timeout errors, create a client with a longer timeout:
|
|
466
|
+
|
|
467
|
+
```typescript
|
|
468
|
+
const client = new OxArchive({
|
|
469
|
+
apiKey: 'ox_your_api_key',
|
|
470
|
+
timeout: 60000 // 60 seconds for data quality endpoints
|
|
471
|
+
});
|
|
472
|
+
```
|
|
473
|
+
|
|
444
474
|
### Legacy API (Deprecated)
|
|
445
475
|
|
|
446
476
|
The following legacy methods are deprecated and will be removed in v2.0. They default to Hyperliquid data:
|
package/dist/index.d.mts
CHANGED
|
@@ -671,6 +671,15 @@ interface CoverageGap {
|
|
|
671
671
|
/** Duration of the gap in minutes */
|
|
672
672
|
durationMinutes: number;
|
|
673
673
|
}
|
|
674
|
+
/** Empirical data cadence measurement based on last 7 days of data */
|
|
675
|
+
interface DataCadence {
|
|
676
|
+
/** Median interval between consecutive records in seconds */
|
|
677
|
+
medianIntervalSeconds: number;
|
|
678
|
+
/** 95th percentile interval between consecutive records in seconds */
|
|
679
|
+
p95IntervalSeconds: number;
|
|
680
|
+
/** Number of intervals sampled for this measurement */
|
|
681
|
+
sampleCount: number;
|
|
682
|
+
}
|
|
674
683
|
/** Coverage for a specific symbol and data type */
|
|
675
684
|
interface SymbolDataTypeCoverage {
|
|
676
685
|
/** Earliest available data timestamp */
|
|
@@ -679,10 +688,21 @@ interface SymbolDataTypeCoverage {
|
|
|
679
688
|
latest: string;
|
|
680
689
|
/** Total number of records */
|
|
681
690
|
totalRecords: number;
|
|
682
|
-
/**
|
|
691
|
+
/** 24-hour completeness percentage (0-100) */
|
|
683
692
|
completeness: number;
|
|
684
|
-
/**
|
|
693
|
+
/** Historical coverage percentage (0-100) based on hours with data / total hours */
|
|
694
|
+
historicalCoverage?: number;
|
|
695
|
+
/** Detected data gaps within the requested time window */
|
|
685
696
|
gaps: CoverageGap[];
|
|
697
|
+
/** Empirical data cadence (present when sufficient data exists) */
|
|
698
|
+
cadence?: DataCadence;
|
|
699
|
+
}
|
|
700
|
+
/** Options for symbol coverage query */
|
|
701
|
+
interface SymbolCoverageOptions {
|
|
702
|
+
/** Start of gap detection window (Unix milliseconds). Default: now - 30 days */
|
|
703
|
+
from?: number;
|
|
704
|
+
/** End of gap detection window (Unix milliseconds). Default: now */
|
|
705
|
+
to?: number;
|
|
686
706
|
}
|
|
687
707
|
/** Per-symbol coverage response */
|
|
688
708
|
interface SymbolCoverageResponse {
|
|
@@ -1075,7 +1095,8 @@ interface TickHistoryParams {
|
|
|
1075
1095
|
declare class OrderBookResource {
|
|
1076
1096
|
private http;
|
|
1077
1097
|
private basePath;
|
|
1078
|
-
|
|
1098
|
+
private coinTransform;
|
|
1099
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1079
1100
|
/**
|
|
1080
1101
|
* Get order book snapshot for a coin
|
|
1081
1102
|
*
|
|
@@ -1267,7 +1288,8 @@ declare class OrderBookResource {
|
|
|
1267
1288
|
declare class TradesResource {
|
|
1268
1289
|
private http;
|
|
1269
1290
|
private basePath;
|
|
1270
|
-
|
|
1291
|
+
private coinTransform;
|
|
1292
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1271
1293
|
/**
|
|
1272
1294
|
* Get trade history for a coin using cursor-based pagination
|
|
1273
1295
|
*
|
|
@@ -1302,9 +1324,10 @@ declare class TradesResource {
|
|
|
1302
1324
|
/**
|
|
1303
1325
|
* Get most recent trades for a coin.
|
|
1304
1326
|
*
|
|
1305
|
-
* Note: This method is
|
|
1306
|
-
* which
|
|
1307
|
-
* endpoint is not available
|
|
1327
|
+
* Note: This method is available for Lighter (client.lighter.trades.recent())
|
|
1328
|
+
* and HIP-3 (client.hyperliquid.hip3.trades.recent()) which have real-time data
|
|
1329
|
+
* ingestion. Hyperliquid uses hourly backfill so this endpoint is not available
|
|
1330
|
+
* for Hyperliquid.
|
|
1308
1331
|
*
|
|
1309
1332
|
* @param coin - The coin symbol (e.g., 'BTC', 'ETH')
|
|
1310
1333
|
* @param limit - Number of trades to return (default: 100)
|
|
@@ -1409,7 +1432,8 @@ declare class LighterInstrumentsResource {
|
|
|
1409
1432
|
declare class FundingResource {
|
|
1410
1433
|
private http;
|
|
1411
1434
|
private basePath;
|
|
1412
|
-
|
|
1435
|
+
private coinTransform;
|
|
1436
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1413
1437
|
/**
|
|
1414
1438
|
* Get funding rate history for a coin with cursor-based pagination
|
|
1415
1439
|
*
|
|
@@ -1458,7 +1482,8 @@ declare class FundingResource {
|
|
|
1458
1482
|
declare class OpenInterestResource {
|
|
1459
1483
|
private http;
|
|
1460
1484
|
private basePath;
|
|
1461
|
-
|
|
1485
|
+
private coinTransform;
|
|
1486
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1462
1487
|
/**
|
|
1463
1488
|
* Get open interest history for a coin with cursor-based pagination
|
|
1464
1489
|
*
|
|
@@ -1645,7 +1670,7 @@ declare class DataQualityResource {
|
|
|
1645
1670
|
/**
|
|
1646
1671
|
* Get data coverage for a specific exchange
|
|
1647
1672
|
*
|
|
1648
|
-
* @param exchange - Exchange name ('hyperliquid' or '
|
|
1673
|
+
* @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
|
|
1649
1674
|
* @returns ExchangeCoverage with coverage info for all data types on this exchange
|
|
1650
1675
|
*
|
|
1651
1676
|
* @example
|
|
@@ -1658,11 +1683,13 @@ declare class DataQualityResource {
|
|
|
1658
1683
|
/**
|
|
1659
1684
|
* Get data coverage for a specific symbol on an exchange
|
|
1660
1685
|
*
|
|
1661
|
-
* Includes gap detection
|
|
1686
|
+
* Includes gap detection, empirical data cadence, and hour-level historical coverage.
|
|
1687
|
+
* Supports optional time bounds for gap detection (default: last 30 days).
|
|
1662
1688
|
*
|
|
1663
|
-
* @param exchange - Exchange name ('hyperliquid' or '
|
|
1664
|
-
* @param symbol - Symbol name (e.g., 'BTC', 'ETH')
|
|
1665
|
-
* @
|
|
1689
|
+
* @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
|
|
1690
|
+
* @param symbol - Symbol name (e.g., 'BTC', 'ETH', or HIP3 coins like 'xyz:XYZ100')
|
|
1691
|
+
* @param options - Optional time bounds for gap detection window
|
|
1692
|
+
* @returns SymbolCoverageResponse with per-data-type coverage including gaps, cadence, and historical coverage
|
|
1666
1693
|
*
|
|
1667
1694
|
* @example
|
|
1668
1695
|
* ```typescript
|
|
@@ -1673,9 +1700,21 @@ declare class DataQualityResource {
|
|
|
1673
1700
|
* for (const gap of oi.gaps.slice(0, 3)) {
|
|
1674
1701
|
* console.log(` ${gap.durationMinutes} min gap at ${gap.start}`);
|
|
1675
1702
|
* }
|
|
1703
|
+
*
|
|
1704
|
+
* // Check cadence
|
|
1705
|
+
* if (btc.dataTypes.orderbook.cadence) {
|
|
1706
|
+
* console.log(`Cadence: ~${btc.dataTypes.orderbook.cadence.medianIntervalSeconds}s`);
|
|
1707
|
+
* }
|
|
1708
|
+
*
|
|
1709
|
+
* // Time-bounded (last 7 days)
|
|
1710
|
+
* const weekAgo = Date.now() - 7 * 24 * 60 * 60 * 1000;
|
|
1711
|
+
* const btc7d = await client.dataQuality.symbolCoverage('hyperliquid', 'BTC', {
|
|
1712
|
+
* from: weekAgo,
|
|
1713
|
+
* to: Date.now(),
|
|
1714
|
+
* });
|
|
1676
1715
|
* ```
|
|
1677
1716
|
*/
|
|
1678
|
-
symbolCoverage(exchange: string, symbol: string): Promise<SymbolCoverageResponse>;
|
|
1717
|
+
symbolCoverage(exchange: string, symbol: string, options?: SymbolCoverageOptions): Promise<SymbolCoverageResponse>;
|
|
1679
1718
|
/**
|
|
1680
1719
|
* List incidents with filtering and pagination
|
|
1681
1720
|
*
|
|
@@ -1783,6 +1822,42 @@ declare class HyperliquidClient {
|
|
|
1783
1822
|
* Liquidation events (May 2025+)
|
|
1784
1823
|
*/
|
|
1785
1824
|
readonly liquidations: LiquidationsResource;
|
|
1825
|
+
/**
|
|
1826
|
+
* HIP-3 builder-deployed perpetuals (Pro+ only, February 2026+)
|
|
1827
|
+
*/
|
|
1828
|
+
readonly hip3: Hip3Client;
|
|
1829
|
+
constructor(http: HttpClient);
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* HIP-3 builder-deployed perpetuals client
|
|
1833
|
+
*
|
|
1834
|
+
* Access Hyperliquid HIP-3 builder perps data through the 0xarchive API.
|
|
1835
|
+
* Requires Pro tier or higher.
|
|
1836
|
+
*
|
|
1837
|
+
* @example
|
|
1838
|
+
* ```typescript
|
|
1839
|
+
* const client = new OxArchive({ apiKey: '...' });
|
|
1840
|
+
* const orderbook = await client.hyperliquid.hip3.orderbook.get('xyz:XYZ100');
|
|
1841
|
+
* const trades = await client.hyperliquid.hip3.trades.recent('xyz:XYZ100');
|
|
1842
|
+
* ```
|
|
1843
|
+
*/
|
|
1844
|
+
declare class Hip3Client {
|
|
1845
|
+
/**
|
|
1846
|
+
* Order book snapshots (February 2026+)
|
|
1847
|
+
*/
|
|
1848
|
+
readonly orderbook: OrderBookResource;
|
|
1849
|
+
/**
|
|
1850
|
+
* Trade/fill history
|
|
1851
|
+
*/
|
|
1852
|
+
readonly trades: TradesResource;
|
|
1853
|
+
/**
|
|
1854
|
+
* Funding rates
|
|
1855
|
+
*/
|
|
1856
|
+
readonly funding: FundingResource;
|
|
1857
|
+
/**
|
|
1858
|
+
* Open interest
|
|
1859
|
+
*/
|
|
1860
|
+
readonly openInterest: OpenInterestResource;
|
|
1786
1861
|
constructor(http: HttpClient);
|
|
1787
1862
|
}
|
|
1788
1863
|
/**
|
|
@@ -3995,4 +4070,4 @@ type ValidatedCandle = z.infer<typeof CandleSchema>;
|
|
|
3995
4070
|
type ValidatedLiquidation = z.infer<typeof LiquidationSchema>;
|
|
3996
4071
|
type ValidatedWsServerMessage = z.infer<typeof WsServerMessageSchema>;
|
|
3997
4072
|
|
|
3998
|
-
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 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 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 };
|
|
4073
|
+
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, 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
|
@@ -671,6 +671,15 @@ interface CoverageGap {
|
|
|
671
671
|
/** Duration of the gap in minutes */
|
|
672
672
|
durationMinutes: number;
|
|
673
673
|
}
|
|
674
|
+
/** Empirical data cadence measurement based on last 7 days of data */
|
|
675
|
+
interface DataCadence {
|
|
676
|
+
/** Median interval between consecutive records in seconds */
|
|
677
|
+
medianIntervalSeconds: number;
|
|
678
|
+
/** 95th percentile interval between consecutive records in seconds */
|
|
679
|
+
p95IntervalSeconds: number;
|
|
680
|
+
/** Number of intervals sampled for this measurement */
|
|
681
|
+
sampleCount: number;
|
|
682
|
+
}
|
|
674
683
|
/** Coverage for a specific symbol and data type */
|
|
675
684
|
interface SymbolDataTypeCoverage {
|
|
676
685
|
/** Earliest available data timestamp */
|
|
@@ -679,10 +688,21 @@ interface SymbolDataTypeCoverage {
|
|
|
679
688
|
latest: string;
|
|
680
689
|
/** Total number of records */
|
|
681
690
|
totalRecords: number;
|
|
682
|
-
/**
|
|
691
|
+
/** 24-hour completeness percentage (0-100) */
|
|
683
692
|
completeness: number;
|
|
684
|
-
/**
|
|
693
|
+
/** Historical coverage percentage (0-100) based on hours with data / total hours */
|
|
694
|
+
historicalCoverage?: number;
|
|
695
|
+
/** Detected data gaps within the requested time window */
|
|
685
696
|
gaps: CoverageGap[];
|
|
697
|
+
/** Empirical data cadence (present when sufficient data exists) */
|
|
698
|
+
cadence?: DataCadence;
|
|
699
|
+
}
|
|
700
|
+
/** Options for symbol coverage query */
|
|
701
|
+
interface SymbolCoverageOptions {
|
|
702
|
+
/** Start of gap detection window (Unix milliseconds). Default: now - 30 days */
|
|
703
|
+
from?: number;
|
|
704
|
+
/** End of gap detection window (Unix milliseconds). Default: now */
|
|
705
|
+
to?: number;
|
|
686
706
|
}
|
|
687
707
|
/** Per-symbol coverage response */
|
|
688
708
|
interface SymbolCoverageResponse {
|
|
@@ -1075,7 +1095,8 @@ interface TickHistoryParams {
|
|
|
1075
1095
|
declare class OrderBookResource {
|
|
1076
1096
|
private http;
|
|
1077
1097
|
private basePath;
|
|
1078
|
-
|
|
1098
|
+
private coinTransform;
|
|
1099
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1079
1100
|
/**
|
|
1080
1101
|
* Get order book snapshot for a coin
|
|
1081
1102
|
*
|
|
@@ -1267,7 +1288,8 @@ declare class OrderBookResource {
|
|
|
1267
1288
|
declare class TradesResource {
|
|
1268
1289
|
private http;
|
|
1269
1290
|
private basePath;
|
|
1270
|
-
|
|
1291
|
+
private coinTransform;
|
|
1292
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1271
1293
|
/**
|
|
1272
1294
|
* Get trade history for a coin using cursor-based pagination
|
|
1273
1295
|
*
|
|
@@ -1302,9 +1324,10 @@ declare class TradesResource {
|
|
|
1302
1324
|
/**
|
|
1303
1325
|
* Get most recent trades for a coin.
|
|
1304
1326
|
*
|
|
1305
|
-
* Note: This method is
|
|
1306
|
-
* which
|
|
1307
|
-
* endpoint is not available
|
|
1327
|
+
* Note: This method is available for Lighter (client.lighter.trades.recent())
|
|
1328
|
+
* and HIP-3 (client.hyperliquid.hip3.trades.recent()) which have real-time data
|
|
1329
|
+
* ingestion. Hyperliquid uses hourly backfill so this endpoint is not available
|
|
1330
|
+
* for Hyperliquid.
|
|
1308
1331
|
*
|
|
1309
1332
|
* @param coin - The coin symbol (e.g., 'BTC', 'ETH')
|
|
1310
1333
|
* @param limit - Number of trades to return (default: 100)
|
|
@@ -1409,7 +1432,8 @@ declare class LighterInstrumentsResource {
|
|
|
1409
1432
|
declare class FundingResource {
|
|
1410
1433
|
private http;
|
|
1411
1434
|
private basePath;
|
|
1412
|
-
|
|
1435
|
+
private coinTransform;
|
|
1436
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1413
1437
|
/**
|
|
1414
1438
|
* Get funding rate history for a coin with cursor-based pagination
|
|
1415
1439
|
*
|
|
@@ -1458,7 +1482,8 @@ declare class FundingResource {
|
|
|
1458
1482
|
declare class OpenInterestResource {
|
|
1459
1483
|
private http;
|
|
1460
1484
|
private basePath;
|
|
1461
|
-
|
|
1485
|
+
private coinTransform;
|
|
1486
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1462
1487
|
/**
|
|
1463
1488
|
* Get open interest history for a coin with cursor-based pagination
|
|
1464
1489
|
*
|
|
@@ -1645,7 +1670,7 @@ declare class DataQualityResource {
|
|
|
1645
1670
|
/**
|
|
1646
1671
|
* Get data coverage for a specific exchange
|
|
1647
1672
|
*
|
|
1648
|
-
* @param exchange - Exchange name ('hyperliquid' or '
|
|
1673
|
+
* @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
|
|
1649
1674
|
* @returns ExchangeCoverage with coverage info for all data types on this exchange
|
|
1650
1675
|
*
|
|
1651
1676
|
* @example
|
|
@@ -1658,11 +1683,13 @@ declare class DataQualityResource {
|
|
|
1658
1683
|
/**
|
|
1659
1684
|
* Get data coverage for a specific symbol on an exchange
|
|
1660
1685
|
*
|
|
1661
|
-
* Includes gap detection
|
|
1686
|
+
* Includes gap detection, empirical data cadence, and hour-level historical coverage.
|
|
1687
|
+
* Supports optional time bounds for gap detection (default: last 30 days).
|
|
1662
1688
|
*
|
|
1663
|
-
* @param exchange - Exchange name ('hyperliquid' or '
|
|
1664
|
-
* @param symbol - Symbol name (e.g., 'BTC', 'ETH')
|
|
1665
|
-
* @
|
|
1689
|
+
* @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
|
|
1690
|
+
* @param symbol - Symbol name (e.g., 'BTC', 'ETH', or HIP3 coins like 'xyz:XYZ100')
|
|
1691
|
+
* @param options - Optional time bounds for gap detection window
|
|
1692
|
+
* @returns SymbolCoverageResponse with per-data-type coverage including gaps, cadence, and historical coverage
|
|
1666
1693
|
*
|
|
1667
1694
|
* @example
|
|
1668
1695
|
* ```typescript
|
|
@@ -1673,9 +1700,21 @@ declare class DataQualityResource {
|
|
|
1673
1700
|
* for (const gap of oi.gaps.slice(0, 3)) {
|
|
1674
1701
|
* console.log(` ${gap.durationMinutes} min gap at ${gap.start}`);
|
|
1675
1702
|
* }
|
|
1703
|
+
*
|
|
1704
|
+
* // Check cadence
|
|
1705
|
+
* if (btc.dataTypes.orderbook.cadence) {
|
|
1706
|
+
* console.log(`Cadence: ~${btc.dataTypes.orderbook.cadence.medianIntervalSeconds}s`);
|
|
1707
|
+
* }
|
|
1708
|
+
*
|
|
1709
|
+
* // Time-bounded (last 7 days)
|
|
1710
|
+
* const weekAgo = Date.now() - 7 * 24 * 60 * 60 * 1000;
|
|
1711
|
+
* const btc7d = await client.dataQuality.symbolCoverage('hyperliquid', 'BTC', {
|
|
1712
|
+
* from: weekAgo,
|
|
1713
|
+
* to: Date.now(),
|
|
1714
|
+
* });
|
|
1676
1715
|
* ```
|
|
1677
1716
|
*/
|
|
1678
|
-
symbolCoverage(exchange: string, symbol: string): Promise<SymbolCoverageResponse>;
|
|
1717
|
+
symbolCoverage(exchange: string, symbol: string, options?: SymbolCoverageOptions): Promise<SymbolCoverageResponse>;
|
|
1679
1718
|
/**
|
|
1680
1719
|
* List incidents with filtering and pagination
|
|
1681
1720
|
*
|
|
@@ -1783,6 +1822,42 @@ declare class HyperliquidClient {
|
|
|
1783
1822
|
* Liquidation events (May 2025+)
|
|
1784
1823
|
*/
|
|
1785
1824
|
readonly liquidations: LiquidationsResource;
|
|
1825
|
+
/**
|
|
1826
|
+
* HIP-3 builder-deployed perpetuals (Pro+ only, February 2026+)
|
|
1827
|
+
*/
|
|
1828
|
+
readonly hip3: Hip3Client;
|
|
1829
|
+
constructor(http: HttpClient);
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* HIP-3 builder-deployed perpetuals client
|
|
1833
|
+
*
|
|
1834
|
+
* Access Hyperliquid HIP-3 builder perps data through the 0xarchive API.
|
|
1835
|
+
* Requires Pro tier or higher.
|
|
1836
|
+
*
|
|
1837
|
+
* @example
|
|
1838
|
+
* ```typescript
|
|
1839
|
+
* const client = new OxArchive({ apiKey: '...' });
|
|
1840
|
+
* const orderbook = await client.hyperliquid.hip3.orderbook.get('xyz:XYZ100');
|
|
1841
|
+
* const trades = await client.hyperliquid.hip3.trades.recent('xyz:XYZ100');
|
|
1842
|
+
* ```
|
|
1843
|
+
*/
|
|
1844
|
+
declare class Hip3Client {
|
|
1845
|
+
/**
|
|
1846
|
+
* Order book snapshots (February 2026+)
|
|
1847
|
+
*/
|
|
1848
|
+
readonly orderbook: OrderBookResource;
|
|
1849
|
+
/**
|
|
1850
|
+
* Trade/fill history
|
|
1851
|
+
*/
|
|
1852
|
+
readonly trades: TradesResource;
|
|
1853
|
+
/**
|
|
1854
|
+
* Funding rates
|
|
1855
|
+
*/
|
|
1856
|
+
readonly funding: FundingResource;
|
|
1857
|
+
/**
|
|
1858
|
+
* Open interest
|
|
1859
|
+
*/
|
|
1860
|
+
readonly openInterest: OpenInterestResource;
|
|
1786
1861
|
constructor(http: HttpClient);
|
|
1787
1862
|
}
|
|
1788
1863
|
/**
|
|
@@ -3995,4 +4070,4 @@ type ValidatedCandle = z.infer<typeof CandleSchema>;
|
|
|
3995
4070
|
type ValidatedLiquidation = z.infer<typeof LiquidationSchema>;
|
|
3996
4071
|
type ValidatedWsServerMessage = z.infer<typeof WsServerMessageSchema>;
|
|
3997
4072
|
|
|
3998
|
-
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 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 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 };
|
|
4073
|
+
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, 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 };
|