@0xarchive/sdk 0.5.4 → 0.6.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/dist/index.js CHANGED
@@ -759,6 +759,186 @@ var LiquidationsResource = class {
759
759
  }
760
760
  };
761
761
 
762
+ // src/resources/data-quality.ts
763
+ var DataQualityResource = class {
764
+ constructor(http, basePath = "/v1/data-quality") {
765
+ this.http = http;
766
+ this.basePath = basePath;
767
+ }
768
+ // ===========================================================================
769
+ // Status Endpoints
770
+ // ===========================================================================
771
+ /**
772
+ * Get overall system health status
773
+ *
774
+ * @returns StatusResponse with overall status, per-exchange status,
775
+ * per-data-type status, and active incident count
776
+ *
777
+ * @example
778
+ * ```typescript
779
+ * const status = await client.dataQuality.status();
780
+ * console.log(`Overall: ${status.status}`);
781
+ * for (const [exchange, info] of Object.entries(status.exchanges)) {
782
+ * console.log(`${exchange}: ${info.status}`);
783
+ * }
784
+ * ```
785
+ */
786
+ async status() {
787
+ return this.http.get(`${this.basePath}/status`);
788
+ }
789
+ // ===========================================================================
790
+ // Coverage Endpoints
791
+ // ===========================================================================
792
+ /**
793
+ * Get data coverage summary for all exchanges
794
+ *
795
+ * @returns CoverageResponse with coverage info for all exchanges and data types
796
+ *
797
+ * @example
798
+ * ```typescript
799
+ * const coverage = await client.dataQuality.coverage();
800
+ * for (const exchange of coverage.exchanges) {
801
+ * console.log(`${exchange.exchange}:`);
802
+ * for (const [dtype, info] of Object.entries(exchange.dataTypes)) {
803
+ * console.log(` ${dtype}: ${info.totalRecords} records`);
804
+ * }
805
+ * }
806
+ * ```
807
+ */
808
+ async coverage() {
809
+ return this.http.get(`${this.basePath}/coverage`);
810
+ }
811
+ /**
812
+ * Get data coverage for a specific exchange
813
+ *
814
+ * @param exchange - Exchange name ('hyperliquid' or 'lighter')
815
+ * @returns ExchangeCoverage with coverage info for all data types on this exchange
816
+ *
817
+ * @example
818
+ * ```typescript
819
+ * const hl = await client.dataQuality.exchangeCoverage('hyperliquid');
820
+ * console.log(`Orderbook earliest: ${hl.dataTypes.orderbook.earliest}`);
821
+ * ```
822
+ */
823
+ async exchangeCoverage(exchange) {
824
+ return this.http.get(
825
+ `${this.basePath}/coverage/${exchange.toLowerCase()}`
826
+ );
827
+ }
828
+ /**
829
+ * Get data coverage for a specific symbol on an exchange
830
+ *
831
+ * Includes gap detection showing periods where data may be missing.
832
+ *
833
+ * @param exchange - Exchange name ('hyperliquid' or 'lighter')
834
+ * @param symbol - Symbol name (e.g., 'BTC', 'ETH')
835
+ * @returns SymbolCoverageResponse with per-data-type coverage including gaps
836
+ *
837
+ * @example
838
+ * ```typescript
839
+ * const btc = await client.dataQuality.symbolCoverage('hyperliquid', 'BTC');
840
+ * const oi = btc.dataTypes.open_interest;
841
+ * console.log(`OI completeness: ${oi.completeness}%`);
842
+ * console.log(`Gaps found: ${oi.gaps.length}`);
843
+ * for (const gap of oi.gaps.slice(0, 3)) {
844
+ * console.log(` ${gap.durationMinutes} min gap at ${gap.start}`);
845
+ * }
846
+ * ```
847
+ */
848
+ async symbolCoverage(exchange, symbol) {
849
+ return this.http.get(
850
+ `${this.basePath}/coverage/${exchange.toLowerCase()}/${symbol.toUpperCase()}`
851
+ );
852
+ }
853
+ // ===========================================================================
854
+ // Incidents Endpoints
855
+ // ===========================================================================
856
+ /**
857
+ * List incidents with filtering and pagination
858
+ *
859
+ * @param params - Filter and pagination options
860
+ * @returns IncidentsResponse with list of incidents and pagination info
861
+ *
862
+ * @example
863
+ * ```typescript
864
+ * // Get all open incidents
865
+ * const result = await client.dataQuality.listIncidents({ status: 'open' });
866
+ * for (const incident of result.incidents) {
867
+ * console.log(`${incident.severity}: ${incident.title}`);
868
+ * }
869
+ * ```
870
+ */
871
+ async listIncidents(params) {
872
+ return this.http.get(
873
+ `${this.basePath}/incidents`,
874
+ params
875
+ );
876
+ }
877
+ /**
878
+ * Get a specific incident by ID
879
+ *
880
+ * @param incidentId - The incident ID
881
+ * @returns Incident details
882
+ *
883
+ * @example
884
+ * ```typescript
885
+ * const incident = await client.dataQuality.getIncident('inc_123');
886
+ * console.log(`Status: ${incident.status}`);
887
+ * console.log(`Root cause: ${incident.rootCause}`);
888
+ * ```
889
+ */
890
+ async getIncident(incidentId) {
891
+ return this.http.get(`${this.basePath}/incidents/${incidentId}`);
892
+ }
893
+ // ===========================================================================
894
+ // Latency Endpoints
895
+ // ===========================================================================
896
+ /**
897
+ * Get current latency metrics for all exchanges
898
+ *
899
+ * @returns LatencyResponse with WebSocket, REST API, and data freshness metrics
900
+ *
901
+ * @example
902
+ * ```typescript
903
+ * const latency = await client.dataQuality.latency();
904
+ * for (const [exchange, metrics] of Object.entries(latency.exchanges)) {
905
+ * console.log(`${exchange}:`);
906
+ * if (metrics.websocket) {
907
+ * console.log(` WS current: ${metrics.websocket.currentMs}ms`);
908
+ * }
909
+ * console.log(` OB lag: ${metrics.dataFreshness.orderbookLagMs}ms`);
910
+ * }
911
+ * ```
912
+ */
913
+ async latency() {
914
+ return this.http.get(`${this.basePath}/latency`);
915
+ }
916
+ // ===========================================================================
917
+ // SLA Endpoints
918
+ // ===========================================================================
919
+ /**
920
+ * Get SLA compliance metrics for a specific month
921
+ *
922
+ * @param params - Optional year and month (defaults to current month)
923
+ * @returns SlaResponse with SLA targets, actual metrics, and compliance status
924
+ *
925
+ * @example
926
+ * ```typescript
927
+ * const sla = await client.dataQuality.sla({ year: 2026, month: 1 });
928
+ * console.log(`Period: ${sla.period}`);
929
+ * console.log(`Uptime: ${sla.actual.uptime}% (${sla.actual.uptimeStatus})`);
930
+ * console.log(`Completeness: ${sla.actual.dataCompleteness.overall}%`);
931
+ * console.log(`API P99: ${sla.actual.apiLatencyP99Ms}ms`);
932
+ * ```
933
+ */
934
+ async sla(params) {
935
+ return this.http.get(
936
+ `${this.basePath}/sla`,
937
+ params
938
+ );
939
+ }
940
+ };
941
+
762
942
  // src/exchanges.ts
763
943
  var HyperliquidClient = class {
764
944
  /**
@@ -849,6 +1029,10 @@ var OxArchive = class {
849
1029
  * Lighter.xyz exchange data (August 2025+)
850
1030
  */
851
1031
  lighter;
1032
+ /**
1033
+ * Data quality metrics: status, coverage, incidents, latency, SLA
1034
+ */
1035
+ dataQuality;
852
1036
  /**
853
1037
  * @deprecated Use client.hyperliquid.orderbook instead
854
1038
  */
@@ -886,6 +1070,7 @@ var OxArchive = class {
886
1070
  });
887
1071
  this.hyperliquid = new HyperliquidClient(this.http);
888
1072
  this.lighter = new LighterClient(this.http);
1073
+ this.dataQuality = new DataQualityResource(this.http);
889
1074
  const legacyBase = "/v1/hyperliquid";
890
1075
  this.orderbook = new OrderBookResource(this.http, legacyBase);
891
1076
  this.trades = new TradesResource(this.http, legacyBase);