@usherlabs/cex-broker 0.2.44 → 0.2.46
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 +1 -1
- package/dist/commands/cli.js +16231 -15573
- package/dist/handlers/subscribe/handler.d.ts +2 -0
- package/dist/helpers/market-data-archive/capture-contract.d.ts +3 -2
- package/dist/helpers/market-data-archive/types.d.ts +8 -4
- package/dist/helpers/market-data-vendor-backfill/archive-reader.d.ts +26 -0
- package/dist/helpers/market-data-vendor-backfill/batching.d.ts +10 -0
- package/dist/helpers/market-data-vendor-backfill/conformance-fixtures.d.ts +80 -0
- package/dist/helpers/market-data-vendor-backfill/contracts.d.ts +393 -0
- package/dist/helpers/market-data-vendor-backfill/core.d.ts +100 -0
- package/dist/helpers/market-data-vendor-backfill/cryptohftdata.d.ts +77 -0
- package/dist/helpers/market-data-vendor-backfill/forwarder-client.d.ts +25 -0
- package/dist/helpers/market-data-vendor-backfill/identity.d.ts +10 -0
- package/dist/helpers/market-data-vendor-backfill/manifests.d.ts +1086 -0
- package/dist/helpers/market-data-vendor-backfill/promotion.d.ts +9 -0
- package/dist/helpers/market-data-vendor-backfill/qualification.d.ts +20 -0
- package/dist/helpers/market-data-vendor-backfill/selection.d.ts +30 -0
- package/dist/helpers/market-data-vendor-backfill/semantic-verification.d.ts +24 -0
- package/dist/helpers/public-market-data-feed/identity.d.ts +12 -0
- package/dist/helpers/public-market-data-feed/index.d.ts +5 -0
- package/dist/helpers/public-market-data-feed/orderbook-coalescing-evidence.d.ts +79 -0
- package/dist/helpers/public-market-data-feed/orderbook-profile.d.ts +54 -0
- package/dist/helpers/public-market-data-feed/subscriber-buffer.d.ts +31 -0
- package/dist/helpers/public-market-data-feed/supervisor.d.ts +82 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16221 -15563
- package/dist/index.js.map +21 -18
- package/dist/market-data-vendor-backfill/fixtures/conformance-v1.json +448 -0
- package/dist/market-data-vendor-backfill/policies/capability-policy.json +28 -0
- package/dist/market-data-vendor-backfill/policies/resource-policy.json +16 -0
- package/dist/market-data-vendor-backfill/schema-manifest.json +31 -0
- package/dist/market-data-vendor-backfill/schemas/archive-selection.schema.json +224 -0
- package/dist/market-data-vendor-backfill/schemas/promotion-receipt.schema.json +171 -0
- package/dist/market-data-vendor-backfill/schemas/request.schema.json +166 -0
- package/dist/market-data-vendor-backfill/schemas/required-clock.schema.json +47 -0
- package/dist/market-data-vendor-backfill/schemas/result.schema.json +198 -0
- package/dist/market-data-vendor-backfill.d.ts +18 -0
- package/dist/market-data-vendor-backfill.js +18819 -0
- package/dist/market-data-vendor-backfill.js.map +206 -0
- package/dist/server.d.ts +2 -1
- package/package.json +24 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type MarketDataVendorBackfillRequest, type ProviderCapability } from "./contracts";
|
|
2
|
+
import type { NormalizedBackfill, ProviderDataset } from "./core";
|
|
3
|
+
export declare const CRYPTOHFTDATA_ADAPTER_VERSION: "cryptohftdata-orderbook/v2";
|
|
4
|
+
export declare const CRYPTOHFTDATA_API_URL: "https://api.cryptohftdata.com";
|
|
5
|
+
export type CryptoHftDataCapabilityProfile = Readonly<{
|
|
6
|
+
profileId: string;
|
|
7
|
+
exchange: string;
|
|
8
|
+
tradingPair: string;
|
|
9
|
+
sourceSymbol: string;
|
|
10
|
+
marketType: "spot" | "swap" | "future";
|
|
11
|
+
providerExchangeId: string;
|
|
12
|
+
historyStartMs: number;
|
|
13
|
+
maxDepth: number;
|
|
14
|
+
eventTimeUnit: "milliseconds";
|
|
15
|
+
receivedTimeUnit: "nanoseconds";
|
|
16
|
+
snapshotGrouping: "event_time_last_update_id_object" | "event_time_final_update_id_object";
|
|
17
|
+
sequenceSemantics: "binance_u_U_pu" | "okx_seq_id_prev_seq_id";
|
|
18
|
+
constructionModes: readonly ["sampled_top_n_snapshot"];
|
|
19
|
+
sourcePolicies: readonly ["authoritative_window"];
|
|
20
|
+
}>;
|
|
21
|
+
export declare const CRYPTOHFTDATA_BINANCE_SPOT_BTCUSDT_PROFILE: CryptoHftDataCapabilityProfile;
|
|
22
|
+
export declare const CRYPTOHFTDATA_OKX_SPOT_ARBUSDT_PROFILE: CryptoHftDataCapabilityProfile;
|
|
23
|
+
export declare class CryptoHftDataError extends Error {
|
|
24
|
+
readonly reason: string;
|
|
25
|
+
constructor(reason: string);
|
|
26
|
+
}
|
|
27
|
+
export type CryptoHftDataOrderBookRow = {
|
|
28
|
+
received_time: string | number | bigint;
|
|
29
|
+
event_time: string | number | bigint;
|
|
30
|
+
transaction_time?: string | number | bigint | null;
|
|
31
|
+
symbol: string;
|
|
32
|
+
event_type: "snapshot" | "update";
|
|
33
|
+
first_update_id?: string | number | bigint | null;
|
|
34
|
+
final_update_id?: string | number | bigint | null;
|
|
35
|
+
prev_final_update_id?: string | number | bigint | null;
|
|
36
|
+
last_update_id?: string | number | bigint | null;
|
|
37
|
+
side: "bid" | "ask";
|
|
38
|
+
price: string;
|
|
39
|
+
quantity: string;
|
|
40
|
+
order_count?: string | number | bigint | null;
|
|
41
|
+
dataset_object_identity: string;
|
|
42
|
+
dataset_object_checksum: string;
|
|
43
|
+
};
|
|
44
|
+
export type ReconstructedCryptoHftBook = {
|
|
45
|
+
targetTimeMs: number;
|
|
46
|
+
sourceTimeMs: number;
|
|
47
|
+
receivedTimeMs: number;
|
|
48
|
+
sequence: string;
|
|
49
|
+
bids: number[][];
|
|
50
|
+
asks: number[][];
|
|
51
|
+
datasetObjectIdentity: string;
|
|
52
|
+
datasetObjectChecksum: string;
|
|
53
|
+
};
|
|
54
|
+
export declare function cryptoHftDataCapabilityFor(request: MarketDataVendorBackfillRequest, profiles?: readonly CryptoHftDataCapabilityProfile[]): ProviderCapability | undefined;
|
|
55
|
+
export declare function enumerateCryptoHftDataObjects(request: MarketDataVendorBackfillRequest, providerExchangeId: string, resolvedSymbol: string): string[];
|
|
56
|
+
export declare function reconstructCryptoHftDataOrderBooks(request: MarketDataVendorBackfillRequest, inputRows: readonly CryptoHftDataOrderBookRow[], profile?: CryptoHftDataCapabilityProfile): ReconstructedCryptoHftBook[];
|
|
57
|
+
export declare function decodeCryptoHftParquetZstd(bytes: Uint8Array): Promise<Record<string, unknown>[]>;
|
|
58
|
+
type CryptoHftDataAdapterOptions = {
|
|
59
|
+
baseUrl?: string;
|
|
60
|
+
fetch?: typeof fetch;
|
|
61
|
+
nowMs?: () => number;
|
|
62
|
+
decode?: (bytes: Uint8Array) => Promise<Record<string, unknown>[]>;
|
|
63
|
+
profiles?: readonly CryptoHftDataCapabilityProfile[];
|
|
64
|
+
};
|
|
65
|
+
export declare class CryptoHftDataAdapter {
|
|
66
|
+
private readonly baseUrl;
|
|
67
|
+
private readonly request;
|
|
68
|
+
private readonly nowMs;
|
|
69
|
+
private readonly decode;
|
|
70
|
+
private readonly profiles;
|
|
71
|
+
constructor(options?: CryptoHftDataAdapterOptions);
|
|
72
|
+
capabilityFor(request: MarketDataVendorBackfillRequest): ProviderCapability | undefined;
|
|
73
|
+
discoverSymbols(providerExchangeId: string): Promise<string[]>;
|
|
74
|
+
acquire(request: MarketDataVendorBackfillRequest, capability: ProviderCapability, credential: unknown): Promise<ProviderDataset<CryptoHftDataOrderBookRow>>;
|
|
75
|
+
normalize(request: MarketDataVendorBackfillRequest, capability: ProviderCapability, dataset: ProviderDataset, captureBundleId: string): Promise<NormalizedBackfill>;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ForwarderBatch } from "./contracts";
|
|
2
|
+
import type { ArchiveClusterIdentity, ProductionForwarderAuthorization } from "./core";
|
|
3
|
+
export type ArchiveForwarderClient = {
|
|
4
|
+
preflight(input: {
|
|
5
|
+
authorizationId: string;
|
|
6
|
+
target: ArchiveClusterIdentity;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
forwarderIdentity: ArchiveClusterIdentity;
|
|
9
|
+
authorization: ProductionForwarderAuthorization;
|
|
10
|
+
}>;
|
|
11
|
+
submit(batch: ForwarderBatch): Promise<{
|
|
12
|
+
ok: boolean;
|
|
13
|
+
inserted: number;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
export type ArchiveForwarderClientOptions = {
|
|
17
|
+
url: string;
|
|
18
|
+
authToken?: string;
|
|
19
|
+
fetch?: typeof globalThis.fetch;
|
|
20
|
+
};
|
|
21
|
+
export declare class ArchiveForwarderSubmissionError extends Error {
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
constructor(reason: string, status?: number);
|
|
24
|
+
}
|
|
25
|
+
export declare function createArchiveForwarderClient(options: ArchiveForwarderClientOptions): ArchiveForwarderClient;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
2
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
3
|
+
[key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
export declare function jcsCanonicalize(value: unknown): string;
|
|
6
|
+
export declare function jcsSha256(value: unknown): string;
|
|
7
|
+
export declare function withoutOwnDigest<T extends Record<string, unknown>>(document: T, digestField: keyof T | string): Omit<T, keyof T> & Record<string, unknown>;
|
|
8
|
+
/** Hashes a wire document while excluding only its own top-level digest field. */
|
|
9
|
+
export declare function documentSha256<T extends Record<string, unknown>>(document: T, digestField: keyof T | string): string;
|
|
10
|
+
export declare function assertDocumentSha256<T extends Record<string, unknown>>(document: T, digestField: keyof T | string): void;
|