@usherlabs/cex-broker 0.2.52 → 0.3.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/commands/cli.js +364 -71
- package/dist/index.js +365 -72
- package/dist/index.js.map +14 -13
- package/package.json +5 -28
- package/dist/commands/cex-canonical-orderbook-export.d.ts +0 -23
- package/dist/commands/cex-canonical-orderbook-export.js +0 -34275
- package/dist/commands/cex-canonical-orderbook-export.js.map +0 -266
- package/dist/commands/market-data-vendor-backfill.d.ts +0 -24
- package/dist/commands/market-data-vendor-backfill.js +0 -34930
- package/dist/commands/market-data-vendor-backfill.js.map +0 -268
- package/dist/handlers/execute-action/context.d.ts +0 -50
- package/dist/handlers/execute-action/deposit.d.ts +0 -2
- package/dist/handlers/execute-action/handler.d.ts +0 -19
- package/dist/handlers/execute-action/index.d.ts +0 -10
- package/dist/handlers/execute-action/internal-transfer.d.ts +0 -2
- package/dist/handlers/execute-action/order-book-call.d.ts +0 -3
- package/dist/handlers/execute-action/orders.d.ts +0 -2
- package/dist/handlers/execute-action/pass-through.d.ts +0 -2
- package/dist/handlers/execute-action/perp-config.d.ts +0 -2
- package/dist/handlers/execute-action/registry.d.ts +0 -5
- package/dist/handlers/execute-action/treasury-call.d.ts +0 -2
- package/dist/handlers/execute-action/withdraw.d.ts +0 -2
- package/dist/handlers/subscribe/broker-lifecycle.d.ts +0 -13
- package/dist/handlers/subscribe/handler.d.ts +0 -20
- package/dist/handlers/subscribe/index.d.ts +0 -2
- package/dist/handlers/types.d.ts +0 -23
- package/dist/helpers/account-balance-archive-poller.d.ts +0 -19
- package/dist/helpers/auth.d.ts +0 -5
- package/dist/helpers/balance-update-archive-consumer.d.ts +0 -16
- package/dist/helpers/binance-user-data-normalization.d.ts +0 -3
- package/dist/helpers/binance-user-data-stream.d.ts +0 -58
- package/dist/helpers/broker-execution-archive/capture.d.ts +0 -41
- package/dist/helpers/broker-execution-archive/index.d.ts +0 -7
- package/dist/helpers/broker-execution-archive/journal-export.d.ts +0 -20
- package/dist/helpers/broker-execution-archive/loss-journal.d.ts +0 -36
- package/dist/helpers/broker-execution-archive/redact.d.ts +0 -7
- package/dist/helpers/broker-execution-archive/rows.d.ts +0 -134
- package/dist/helpers/broker-execution-archive/types.d.ts +0 -26
- package/dist/helpers/broker-execution-archive/withdrawal-observation-tracker.d.ts +0 -23
- package/dist/helpers/broker-execution-archive/writer.d.ts +0 -105
- package/dist/helpers/broker.d.ts +0 -38
- package/dist/helpers/canonical-orderbook-export/exact-selection.d.ts +0 -21
- package/dist/helpers/canonical-orderbook-export/exporter.d.ts +0 -26
- package/dist/helpers/canonical-orderbook-export/parquet-projection.d.ts +0 -19
- package/dist/helpers/constants.d.ts +0 -36
- package/dist/helpers/deposit-archive-poller.d.ts +0 -66
- package/dist/helpers/deposit.d.ts +0 -5
- package/dist/helpers/exchange-credentials.d.ts +0 -10
- package/dist/helpers/fill-archive-poller.d.ts +0 -42
- package/dist/helpers/grpc/broker.d.ts +0 -5
- package/dist/helpers/grpc/callbacks.d.ts +0 -9
- package/dist/helpers/grpc/payload.d.ts +0 -9
- package/dist/helpers/grpc/status.d.ts +0 -8
- package/dist/helpers/index.d.ts +0 -44
- package/dist/helpers/logger.d.ts +0 -13
- package/dist/helpers/market-data-archive/canonical-orderbook.d.ts +0 -20
- package/dist/helpers/market-data-archive/capture-context.d.ts +0 -53
- package/dist/helpers/market-data-archive/capture-contract.d.ts +0 -30
- package/dist/helpers/market-data-archive/capture.d.ts +0 -22
- package/dist/helpers/market-data-archive/index.d.ts +0 -13
- package/dist/helpers/market-data-archive/legacy-migration.d.ts +0 -37
- package/dist/helpers/market-data-archive/ohlcv-bar-tracker.d.ts +0 -11
- package/dist/helpers/market-data-archive/ohlcv-bootstrap.d.ts +0 -1
- package/dist/helpers/market-data-archive/ohlcv-history.d.ts +0 -8
- package/dist/helpers/market-data-archive/orderbook-depth.d.ts +0 -5
- package/dist/helpers/market-data-archive/orderbook-sampler.d.ts +0 -12
- package/dist/helpers/market-data-archive/parse-stream.d.ts +0 -26
- package/dist/helpers/market-data-archive/rows.d.ts +0 -14
- package/dist/helpers/market-data-archive/types.d.ts +0 -83
- package/dist/helpers/market-data-preparation/conformance-fixtures.d.ts +0 -128
- package/dist/helpers/market-data-preparation/contracts.d.ts +0 -2970
- package/dist/helpers/market-data-preparation/file-job.d.ts +0 -38
- package/dist/helpers/market-data-preparation/required-clock-qualification.d.ts +0 -43
- package/dist/helpers/market-data-preparation/source-tape-dependencies.d.ts +0 -19
- package/dist/helpers/market-data-preparation/source-tape-operation.d.ts +0 -109
- package/dist/helpers/market-data-source-forensics.d.ts +0 -400
- package/dist/helpers/market-data-vendor-backfill/archive-reader.d.ts +0 -26
- package/dist/helpers/market-data-vendor-backfill/batching.d.ts +0 -10
- package/dist/helpers/market-data-vendor-backfill/conformance-fixtures.d.ts +0 -78
- package/dist/helpers/market-data-vendor-backfill/contracts.d.ts +0 -358
- package/dist/helpers/market-data-vendor-backfill/core.d.ts +0 -101
- package/dist/helpers/market-data-vendor-backfill/cryptohftdata.d.ts +0 -118
- package/dist/helpers/market-data-vendor-backfill/forwarder-client.d.ts +0 -25
- package/dist/helpers/market-data-vendor-backfill/identity.d.ts +0 -10
- package/dist/helpers/market-data-vendor-backfill/manifests.d.ts +0 -61
- package/dist/helpers/market-data-vendor-backfill/promotion.d.ts +0 -10
- package/dist/helpers/market-data-vendor-backfill/qualification.d.ts +0 -20
- package/dist/helpers/market-data-vendor-backfill/selection.d.ts +0 -30
- package/dist/helpers/market-data-vendor-backfill/semantic-verification.d.ts +0 -25
- package/dist/helpers/market-type.d.ts +0 -16
- package/dist/helpers/order-activity-tracker.d.ts +0 -22
- package/dist/helpers/order-book.d.ts +0 -79
- package/dist/helpers/order-telemetry.d.ts +0 -50
- package/dist/helpers/otel.d.ts +0 -83
- package/dist/helpers/passive-order.d.ts +0 -8
- package/dist/helpers/public-market-data-feed/identity.d.ts +0 -12
- package/dist/helpers/public-market-data-feed/index.d.ts +0 -5
- package/dist/helpers/public-market-data-feed/orderbook-coalescing-evidence.d.ts +0 -79
- package/dist/helpers/public-market-data-feed/orderbook-profile.d.ts +0 -54
- package/dist/helpers/public-market-data-feed/subscriber-buffer.d.ts +0 -31
- package/dist/helpers/public-market-data-feed/supervisor.d.ts +0 -82
- package/dist/helpers/shared/errors.d.ts +0 -14
- package/dist/helpers/shared/guards.d.ts +0 -2
- package/dist/helpers/source-tape-sandbox.d.ts +0 -82
- package/dist/helpers/source-tape.d.ts +0 -165
- package/dist/helpers/stream-health-publisher.d.ts +0 -41
- package/dist/helpers/trace-context.d.ts +0 -8
- package/dist/helpers/transfer-network.d.ts +0 -12
- package/dist/helpers/travel-rule-deposit-reconciler.d.ts +0 -159
- package/dist/helpers/travel-rule.d.ts +0 -75
- package/dist/helpers/treasury-discovery.d.ts +0 -17
- package/dist/helpers/user-asset-archive-poller.d.ts +0 -19
- package/dist/helpers/user-data-stream-supervisor.d.ts +0 -27
- package/dist/helpers/verity.d.ts +0 -5
- package/dist/index.d.ts +0 -56
- package/dist/market-data-preparation/fixtures/conformance-v3.json +0 -621
- package/dist/market-data-preparation/policies/capability-policy.json +0 -39
- package/dist/market-data-preparation/policies/resource-policy.json +0 -16
- package/dist/market-data-preparation/policies/source-tape-capability-v1.json +0 -35
- package/dist/market-data-preparation/schema-manifest.json +0 -66
- package/dist/market-data-preparation/schemas/archive-selection-v1.schema.json +0 -224
- package/dist/market-data-preparation/schemas/backfill-request-v1.schema.json +0 -166
- package/dist/market-data-preparation/schemas/backfill-result-v2.schema.json +0 -212
- package/dist/market-data-preparation/schemas/canonical-orderbook-export-request-v1.schema.json +0 -61
- package/dist/market-data-preparation/schemas/canonical-orderbook-export-result-v2.schema.json +0 -252
- package/dist/market-data-preparation/schemas/order-book-depth-summary-parquet-projection-v1.schema.json +0 -256
- package/dist/market-data-preparation/schemas/order-book-levels-parquet-projection-v1.schema.json +0 -220
- package/dist/market-data-preparation/schemas/preparation-product-pin-v2.schema.json +0 -176
- package/dist/market-data-preparation/schemas/promotion-receipt-v1.schema.json +0 -175
- package/dist/market-data-preparation/schemas/required-clock-v1.schema.json +0 -47
- package/dist/market-data-preparation/schemas/source-forensics-ledger-v1.schema.json +0 -463
- package/dist/market-data-preparation/schemas/source-qualification-record-v1.schema.json +0 -394
- package/dist/market-data-preparation.d.ts +0 -11
- package/dist/market-data-preparation.js +0 -37488
- package/dist/market-data-preparation.js.map +0 -277
- package/dist/market-data-vendor-backfill.d.ts +0 -21
- package/dist/market-data-vendor-backfill.js +0 -22463
- package/dist/market-data-vendor-backfill.js.map +0 -199
- package/dist/proto/node.descriptor.d.ts +0 -127
- package/dist/proto-loader-options.d.ts +0 -7
- package/dist/proto-package-definition.d.ts +0 -2
- package/dist/schemas/action-payloads.d.ts +0 -88
- package/dist/server.d.ts +0 -10
- package/dist/types.d.ts +0 -100
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { OtelLogs, OtelMetrics } from "../otel";
|
|
2
|
-
import { type BrokerArchiveRow, type BrokerArchiveSource, type BrokerArchiveTable } from "./types";
|
|
3
|
-
export declare function isBrokerExecutionArchiveTable(table: BrokerArchiveTable): boolean;
|
|
4
|
-
export type BrokerExecutionArchiverOptions = {
|
|
5
|
-
source?: BrokerArchiveSource;
|
|
6
|
-
deploymentId?: string;
|
|
7
|
-
otelLogs?: OtelLogs;
|
|
8
|
-
otelMetrics?: OtelMetrics;
|
|
9
|
-
forwarderUrl: string;
|
|
10
|
-
deadLetterPath: string;
|
|
11
|
-
maxQueueSize?: number;
|
|
12
|
-
batchSize?: number;
|
|
13
|
-
flushIntervalMs?: number;
|
|
14
|
-
forwarderTimeoutMs?: number;
|
|
15
|
-
};
|
|
16
|
-
export declare class BrokerExecutionArchiveDurabilityError extends Error {
|
|
17
|
-
constructor(message: string, options?: ErrorOptions);
|
|
18
|
-
}
|
|
19
|
-
export declare function rethrowArchiveDurabilityError(error: unknown): void;
|
|
20
|
-
type ArchiverStats = {
|
|
21
|
-
enqueued: number;
|
|
22
|
-
shed: number;
|
|
23
|
-
flushed: number;
|
|
24
|
-
forwarderFailures: number;
|
|
25
|
-
};
|
|
26
|
-
export type BrokerExecutionArchiveHealthSnapshot = {
|
|
27
|
-
healthy: boolean;
|
|
28
|
-
queue_depth: number;
|
|
29
|
-
oldest_pending_age_ms: number;
|
|
30
|
-
shed_total: number;
|
|
31
|
-
last_failure_at: number | null;
|
|
32
|
-
last_shed_at: number | null;
|
|
33
|
-
last_success_at: number | null;
|
|
34
|
-
sink_latency_ms: number | null;
|
|
35
|
-
sink_errors_total: number;
|
|
36
|
-
in_flight: boolean;
|
|
37
|
-
in_flight_age_ms: number;
|
|
38
|
-
};
|
|
39
|
-
export declare function isArchiveOtelLogsEnabled(): boolean;
|
|
40
|
-
export declare function resolveArchiveForwarderUrlFromEnv(): string | undefined;
|
|
41
|
-
export declare function resolveArchiveSourceFromEnv(value?: string | undefined): BrokerArchiveSource;
|
|
42
|
-
export declare class BrokerExecutionArchiver {
|
|
43
|
-
private readonly source;
|
|
44
|
-
private readonly deploymentId;
|
|
45
|
-
private readonly otelLogs?;
|
|
46
|
-
private readonly otelMetrics?;
|
|
47
|
-
private readonly forwarderUrl?;
|
|
48
|
-
private readonly deadLetterPath?;
|
|
49
|
-
private deadLetterFd?;
|
|
50
|
-
private readonly maxQueueSize;
|
|
51
|
-
private readonly batchSize;
|
|
52
|
-
private readonly flushIntervalMs;
|
|
53
|
-
private readonly forwarderTimeoutMs;
|
|
54
|
-
private readonly queue;
|
|
55
|
-
private readonly enqueueTimes;
|
|
56
|
-
private readonly stats;
|
|
57
|
-
private pendingRetry;
|
|
58
|
-
private flushTimer;
|
|
59
|
-
private flushInFlight;
|
|
60
|
-
private inFlightBatch;
|
|
61
|
-
private inFlightStartedAtMs;
|
|
62
|
-
private lastFailureAtMs;
|
|
63
|
-
private lastShedAtMs;
|
|
64
|
-
private lastSuccessAtMs;
|
|
65
|
-
private lastFailureEventSequence;
|
|
66
|
-
private lastShedEventSequence;
|
|
67
|
-
private lastSuccessEventSequence;
|
|
68
|
-
private lastSinkLatencyMs;
|
|
69
|
-
private healthEventSequence;
|
|
70
|
-
private lastShedWarnAtMs;
|
|
71
|
-
private closing;
|
|
72
|
-
private closed;
|
|
73
|
-
private readonly enabled;
|
|
74
|
-
private readonly forwarderAuthToken?;
|
|
75
|
-
private constructor();
|
|
76
|
-
static disabled(): BrokerExecutionArchiver;
|
|
77
|
-
static create(options: BrokerExecutionArchiverOptions): BrokerExecutionArchiver;
|
|
78
|
-
getDeploymentId(): string;
|
|
79
|
-
getSource(): BrokerArchiveSource;
|
|
80
|
-
isEnabled(): boolean;
|
|
81
|
-
canPersistMarketMetadataSnapshot(): boolean;
|
|
82
|
-
canPersistAccountBalanceSnapshots(): boolean;
|
|
83
|
-
enqueue(row: BrokerArchiveRow): void;
|
|
84
|
-
enqueueInBackground(row: BrokerArchiveRow): void;
|
|
85
|
-
flush(): Promise<void>;
|
|
86
|
-
close(): Promise<void>;
|
|
87
|
-
getStats(): Readonly<ArchiverStats>;
|
|
88
|
-
getQueueDepth(): number;
|
|
89
|
-
getHealthSnapshot(): Readonly<BrokerExecutionArchiveHealthSnapshot>;
|
|
90
|
-
private oldestPendingEnqueueAtMs;
|
|
91
|
-
private recordHealthEvent;
|
|
92
|
-
private emitArchiveHealthMetrics;
|
|
93
|
-
private closeLossJournal;
|
|
94
|
-
private appendLossRecords;
|
|
95
|
-
private flushBatch;
|
|
96
|
-
private clearInFlightBatch;
|
|
97
|
-
private recordFlushHealth;
|
|
98
|
-
private recordArchiveMetric;
|
|
99
|
-
private recordArchiveGauge;
|
|
100
|
-
private recordArchiveObservableGauge;
|
|
101
|
-
private emitOtelLog;
|
|
102
|
-
private postToForwarder;
|
|
103
|
-
}
|
|
104
|
-
export declare function createBrokerExecutionArchiverFromEnv(otelLogs?: OtelLogs, otelMetrics?: OtelMetrics): BrokerExecutionArchiver;
|
|
105
|
-
export {};
|
package/dist/helpers/broker.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from "@grpc/grpc-js";
|
|
2
|
-
import type { Exchange } from "@usherlabs/ccxt";
|
|
3
|
-
import type { BrokerAccountRole, BrokerCredentials } from "../types";
|
|
4
|
-
export type BrokerAccount = {
|
|
5
|
-
exchange: Exchange;
|
|
6
|
-
label: "primary" | `secondary:${number}`;
|
|
7
|
-
index?: number;
|
|
8
|
-
role?: BrokerAccountRole;
|
|
9
|
-
email?: string;
|
|
10
|
-
subAccountId?: string;
|
|
11
|
-
uid?: string;
|
|
12
|
-
};
|
|
13
|
-
export type BrokerPoolEntry = {
|
|
14
|
-
primary: BrokerAccount;
|
|
15
|
-
secondaryBrokers: BrokerAccount[];
|
|
16
|
-
};
|
|
17
|
-
export declare class BrokerAccountPreconditionError extends Error {
|
|
18
|
-
constructor(message: string);
|
|
19
|
-
}
|
|
20
|
-
export declare function requireDestinationEmail(dest: BrokerAccount, transferType: "sub-to-sub" | "primary-to-sub"): string;
|
|
21
|
-
export declare function applyCommonExchangeConfig(exchange: Exchange): void;
|
|
22
|
-
export declare function createBroker(cex: string, credsOrMetadata: {
|
|
23
|
-
apiKey: string;
|
|
24
|
-
apiSecret: string;
|
|
25
|
-
} | Metadata): Exchange | null;
|
|
26
|
-
export declare function createPublicBroker(cex: string): Exchange | null;
|
|
27
|
-
type EnvConfigMap = Record<string, Partial<BrokerCredentials> & {
|
|
28
|
-
_secondaryMap?: Record<number, Partial<BrokerCredentials>>;
|
|
29
|
-
}>;
|
|
30
|
-
type ValidatedCredentialsMap = Record<string, BrokerCredentials & {
|
|
31
|
-
secondaryKeys: BrokerCredentials[];
|
|
32
|
-
}>;
|
|
33
|
-
export declare function createBrokerPool(cfg: EnvConfigMap | ValidatedCredentialsMap): Record<string, BrokerPoolEntry>;
|
|
34
|
-
export declare function selectBroker(brokers: BrokerPoolEntry | undefined, metadata: Metadata): Exchange | null;
|
|
35
|
-
export declare function getCurrentBrokerSelector(metadata: Metadata): string;
|
|
36
|
-
export declare function resolveBrokerAccount(brokers: BrokerPoolEntry | undefined, selector: string): BrokerAccount | null;
|
|
37
|
-
export declare function selectBrokerAccount(brokers: BrokerPoolEntry | undefined, metadata: Metadata): BrokerAccount | null;
|
|
38
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type CanonicalOrderBookExportQuerySegment, type CanonicalOrderBookExportRequestWire } from "../market-data-preparation/contracts";
|
|
2
|
-
import { type Sha256Hex } from "../market-data-vendor-backfill/contracts";
|
|
3
|
-
export type ExactOrderBookQueryValue = string | number | readonly string[];
|
|
4
|
-
export type CompiledExactOrderBookExport = {
|
|
5
|
-
request: CanonicalOrderBookExportRequestWire;
|
|
6
|
-
segments: CanonicalOrderBookExportQuerySegment[];
|
|
7
|
-
querySha256: Sha256Hex;
|
|
8
|
-
parameters: Readonly<Record<string, ExactOrderBookQueryValue>>;
|
|
9
|
-
predicateSql: string;
|
|
10
|
-
physicalPredicateSql: string;
|
|
11
|
-
levelsSql: string;
|
|
12
|
-
summarySql: string;
|
|
13
|
-
conflictsSql: string;
|
|
14
|
-
rowCountsSql: string;
|
|
15
|
-
promotionReceiptsSql: string;
|
|
16
|
-
};
|
|
17
|
-
export declare class ExactOrderBookExportError extends Error {
|
|
18
|
-
readonly reason: string;
|
|
19
|
-
constructor(reason: string);
|
|
20
|
-
}
|
|
21
|
-
export declare function compileExactOrderBookExport(requestInput: CanonicalOrderBookExportRequestWire): CompiledExactOrderBookExport;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { CanonicalOrderBookExportArtifact, CanonicalOrderBookExportRequestWire } from "../market-data-preparation/contracts";
|
|
2
|
-
import { type CompiledExactOrderBookExport, type ExactOrderBookQueryValue } from "./exact-selection";
|
|
3
|
-
export type ExactOrderBookExportFormat = "JSONEachRow" | "Parquet";
|
|
4
|
-
export type ExactOrderBookExportQueryClient = {
|
|
5
|
-
execute(sql: string, parameters: Readonly<Record<string, ExactOrderBookQueryValue>>, format: ExactOrderBookExportFormat): Promise<Uint8Array>;
|
|
6
|
-
};
|
|
7
|
-
export type ExactCanonicalOrderBookExport = {
|
|
8
|
-
compiled: CompiledExactOrderBookExport;
|
|
9
|
-
promotionReceiptIds: string[];
|
|
10
|
-
levelsPath: string;
|
|
11
|
-
summaryPath: string;
|
|
12
|
-
levels: CanonicalOrderBookExportArtifact;
|
|
13
|
-
summary: CanonicalOrderBookExportArtifact;
|
|
14
|
-
};
|
|
15
|
-
export type ClickHouseExactExportClientOptions = {
|
|
16
|
-
url: string;
|
|
17
|
-
username?: string;
|
|
18
|
-
password?: string;
|
|
19
|
-
fetch?: typeof globalThis.fetch;
|
|
20
|
-
};
|
|
21
|
-
export declare function createClickHouseExactOrderBookExportClient(options: ClickHouseExactExportClientOptions): ExactOrderBookExportQueryClient;
|
|
22
|
-
export declare function exportExactCanonicalOrderBook(input: {
|
|
23
|
-
request: CanonicalOrderBookExportRequestWire;
|
|
24
|
-
client: ExactOrderBookExportQueryClient;
|
|
25
|
-
outputDirectory: string;
|
|
26
|
-
}): Promise<ExactCanonicalOrderBookExport>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type ProjectionColumn = {
|
|
2
|
-
name: string;
|
|
3
|
-
physical_type: string;
|
|
4
|
-
logical_type: string | null;
|
|
5
|
-
nullable: boolean;
|
|
6
|
-
};
|
|
7
|
-
type ProjectionDocument = {
|
|
8
|
-
$id: string;
|
|
9
|
-
canonical_schema_id: string;
|
|
10
|
-
file_name: string;
|
|
11
|
-
parquet_metadata: {
|
|
12
|
-
key_value_metadata: unknown[];
|
|
13
|
-
};
|
|
14
|
-
columns: ProjectionColumn[];
|
|
15
|
-
};
|
|
16
|
-
export declare function assertParquetProjection(bytes: Uint8Array, projection: ProjectionDocument): void;
|
|
17
|
-
export declare function assertLevelsParquetProjection(bytes: Uint8Array): void;
|
|
18
|
-
export declare function assertDepthSummaryParquetProjection(bytes: Uint8Array): void;
|
|
19
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export declare const CCXT_METHODS_WITH_VERITY: string[];
|
|
2
|
-
export declare const Action: {
|
|
3
|
-
readonly NoAction: 0;
|
|
4
|
-
readonly Deposit: 1;
|
|
5
|
-
readonly Withdraw: 2;
|
|
6
|
-
readonly CreateOrder: 3;
|
|
7
|
-
readonly GetOrderDetails: 4;
|
|
8
|
-
readonly CancelOrder: 5;
|
|
9
|
-
readonly FetchBalances: 6;
|
|
10
|
-
readonly FetchDepositAddresses: 7;
|
|
11
|
-
readonly FetchTicker: 8;
|
|
12
|
-
readonly FetchCurrency: 9;
|
|
13
|
-
readonly Call: 10;
|
|
14
|
-
readonly FetchAccountId: 11;
|
|
15
|
-
readonly FetchFees: 12;
|
|
16
|
-
readonly InternalTransfer: 13;
|
|
17
|
-
readonly GetPerpConfigState: 14;
|
|
18
|
-
readonly SetPerpConfigState: 15;
|
|
19
|
-
};
|
|
20
|
-
export declare const SubscriptionType: {
|
|
21
|
-
readonly NO_ACTION: 0;
|
|
22
|
-
readonly ORDERBOOK: 1;
|
|
23
|
-
readonly TRADES: 2;
|
|
24
|
-
readonly TICKER: 3;
|
|
25
|
-
readonly OHLCV: 4;
|
|
26
|
-
readonly BALANCE: 5;
|
|
27
|
-
readonly ORDERS: 6;
|
|
28
|
-
};
|
|
29
|
-
export type Action = (typeof Action)[keyof typeof Action];
|
|
30
|
-
export type ActionName = keyof typeof Action;
|
|
31
|
-
export type SubscriptionType = (typeof SubscriptionType)[keyof typeof SubscriptionType];
|
|
32
|
-
export type SubscriptionTypeName = keyof typeof SubscriptionType;
|
|
33
|
-
export declare function getActionName(action: unknown): string;
|
|
34
|
-
export declare function getSubscriptionTypeName(subscriptionType: unknown): string;
|
|
35
|
-
export declare function resolveAction(action: Action | ActionName | undefined): Action | undefined;
|
|
36
|
-
export declare function resolveSubscriptionType(type: SubscriptionType | SubscriptionTypeName | undefined): SubscriptionType;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { BrokerPoolEntry } from "./broker";
|
|
2
|
-
import { type BrokerExecutionArchiver } from "./broker-execution-archive";
|
|
3
|
-
import type { OtelMetrics } from "./otel";
|
|
4
|
-
export type DepositArchivePollerConfig = {
|
|
5
|
-
pollIntervalMs: number;
|
|
6
|
-
fetchTimeoutMs: number;
|
|
7
|
-
lookbackMs: number;
|
|
8
|
-
depositsLimit: number;
|
|
9
|
-
};
|
|
10
|
-
type BinanceUnlockProgressState = "pending" | "credited_not_withdrawable" | "ok" | "failed" | "unknown";
|
|
11
|
-
type BinanceUnlockProgressQuality = "valid" | "unknown" | "contradictory";
|
|
12
|
-
declare const BINANCE_UNLOCK_PROGRESS_SOURCE: {
|
|
13
|
-
readonly venue: "binance";
|
|
14
|
-
readonly endpoint: "GET /sapi/v1/capital/deposit/hisrec";
|
|
15
|
-
readonly fields: {
|
|
16
|
-
readonly status: "info.status";
|
|
17
|
-
readonly confirmTimes: "info.confirmTimes";
|
|
18
|
-
readonly unlockConfirm: "info.unlockConfirm";
|
|
19
|
-
readonly completeTime: "info.completeTime";
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export type BinanceUnlockProgress = {
|
|
23
|
-
version: 1;
|
|
24
|
-
state: BinanceUnlockProgressState;
|
|
25
|
-
progress_state: BinanceUnlockProgressQuality;
|
|
26
|
-
reason: string | null;
|
|
27
|
-
native_status: number | null;
|
|
28
|
-
current: number | null;
|
|
29
|
-
credit_required: number | null;
|
|
30
|
-
unlock_required: number | null;
|
|
31
|
-
complete_time: number | null;
|
|
32
|
-
observed_at: string;
|
|
33
|
-
source: typeof BINANCE_UNLOCK_PROGRESS_SOURCE;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Extracts Binance's native deposit confirmation fields without trusting
|
|
37
|
-
* ccxt's normalized status. `confirmTimes` is normally the venue string
|
|
38
|
-
* `"current/credit_required"`; the object form is accepted only for callers
|
|
39
|
-
* that already decoded that exact field.
|
|
40
|
-
*/
|
|
41
|
-
export declare function parseBinanceUnlockProgress(record: Record<string, unknown>): BinanceUnlockProgress;
|
|
42
|
-
/**
|
|
43
|
-
* Advances the inclusive since-watermark only across a fully observed,
|
|
44
|
-
* terminal prefix of deposit history.
|
|
45
|
-
*/
|
|
46
|
-
export declare function nextDepositCursor(deposits: unknown[], currentSince: number, depositsLimit: number, exchangeId?: string): number;
|
|
47
|
-
/**
|
|
48
|
-
* Broker-internal periodic capture of venue deposit history. It polls every
|
|
49
|
-
* configured account sequentially, using ccxt's unfiltered deposit-history
|
|
50
|
-
* surface so newly funded currencies do not depend on balance or market
|
|
51
|
-
* discovery.
|
|
52
|
-
*/
|
|
53
|
-
export declare class DepositArchivePoller {
|
|
54
|
-
#private;
|
|
55
|
-
private readonly params;
|
|
56
|
-
constructor(params: {
|
|
57
|
-
brokers: Record<string, BrokerPoolEntry>;
|
|
58
|
-
archiver: BrokerExecutionArchiver;
|
|
59
|
-
metrics?: OtelMetrics;
|
|
60
|
-
config?: Partial<DepositArchivePollerConfig>;
|
|
61
|
-
});
|
|
62
|
-
start(): void;
|
|
63
|
-
stop(): Promise<void>;
|
|
64
|
-
pollAllOnce(): Promise<boolean>;
|
|
65
|
-
}
|
|
66
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function depositField(deposit: Record<string, unknown>, fields: string[]): {} | undefined;
|
|
2
|
-
export declare function normalizeDepositStatus(status: unknown): "unsupported" | "not_found" | "pending" | "credited" | "failed" | "timed_out";
|
|
3
|
-
export declare function depositMatchesTransaction(deposit: Record<string, unknown>, transactionHash: string): boolean;
|
|
4
|
-
export declare function stringAmountEquals(left: unknown, right: unknown): boolean;
|
|
5
|
-
export declare function normalizeAddress(value: unknown): string | undefined;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Exchange } from "@usherlabs/ccxt";
|
|
2
|
-
export type BrokerKeyPair = {
|
|
3
|
-
apiKey: string;
|
|
4
|
-
apiSecret: string;
|
|
5
|
-
};
|
|
6
|
-
type RequiredCredentials = Exchange["requiredCredentials"];
|
|
7
|
-
export declare function getExchangeRequiredCredentials(cex: string): RequiredCredentials | null;
|
|
8
|
-
export declare function isWalletBasedExchange(cex: string): boolean;
|
|
9
|
-
export declare function buildCcxtConfig(cex: string, creds: BrokerKeyPair): Record<string, string> | null;
|
|
10
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { BrokerPoolEntry } from "./broker";
|
|
2
|
-
import { type BrokerExecutionArchiver } from "./broker-execution-archive";
|
|
3
|
-
import type { OrderActivityTracker } from "./order-activity-tracker";
|
|
4
|
-
import type { OtelMetrics } from "./otel";
|
|
5
|
-
export type FillArchivePollerConfig = {
|
|
6
|
-
pollIntervalMs: number;
|
|
7
|
-
lookbackMs: number;
|
|
8
|
-
tradesLimit: number;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Advances a since-cursor past the newest trade in a batch. The next poll asks for
|
|
12
|
-
* trades strictly after the last one seen (+1ms) so the same trade is not refetched
|
|
13
|
-
* every tick, while still tolerating out-of-order timestamps within a batch.
|
|
14
|
-
*/
|
|
15
|
-
export declare function nextFillCursor(trades: unknown[], currentSince: number): number;
|
|
16
|
-
/**
|
|
17
|
-
* Broker-internal periodic capture of per-fill facts. For each (account, symbol)
|
|
18
|
-
* that saw recent order activity it calls the venue trade-history endpoint
|
|
19
|
-
* (fetchMyTrades) with a since-cursor and archives each trade to
|
|
20
|
-
* broker_execution.fill_events. Started at bootstrap only when archiving is
|
|
21
|
-
* enabled; symbols are staggered by sequential awaits so one tick never bursts the
|
|
22
|
-
* venue rate limit. Mirrors the TravelRuleDepositReconciler lifecycle.
|
|
23
|
-
*/
|
|
24
|
-
export declare class FillArchivePoller {
|
|
25
|
-
#private;
|
|
26
|
-
private readonly params;
|
|
27
|
-
constructor(params: {
|
|
28
|
-
brokers: Record<string, BrokerPoolEntry>;
|
|
29
|
-
archiver: BrokerExecutionArchiver;
|
|
30
|
-
tracker: OrderActivityTracker;
|
|
31
|
-
metrics?: OtelMetrics;
|
|
32
|
-
config?: Partial<FillArchivePollerConfig>;
|
|
33
|
-
});
|
|
34
|
-
start(): void;
|
|
35
|
-
stop(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Runs one poll pass over every tracked (account, symbol), sequentially so the
|
|
38
|
-
* per-symbol awaits stagger venue calls. Exposed for tests (the timer loop calls
|
|
39
|
-
* it every tick).
|
|
40
|
-
*/
|
|
41
|
-
pollTrackedOnce(): Promise<void>;
|
|
42
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from "@grpc/grpc-js";
|
|
2
|
-
import type { Exchange } from "@usherlabs/ccxt";
|
|
3
|
-
import { type BrokerAccount, type BrokerPoolEntry } from "../broker";
|
|
4
|
-
export declare function resolveActionBroker(normalizedCex: string, brokers: Record<string, BrokerPoolEntry>, metadata: Metadata, selectedBrokerAccount?: BrokerAccount): Exchange | null;
|
|
5
|
-
export declare function selectBrokerAccountForCex(normalizedCex: string, brokers: Record<string, BrokerPoolEntry>, metadata: Metadata): BrokerAccount | undefined;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as grpc from "@grpc/grpc-js";
|
|
2
|
-
import type { z } from "zod";
|
|
3
|
-
import { type ParsePayloadResult } from "./payload";
|
|
4
|
-
export declare function invalidArgumentError(message: string): grpc.ServiceError;
|
|
5
|
-
export declare function rejectInvalidPayload<T>(parsed: ParsePayloadResult<T>, callback: (error: grpc.ServiceError | null, value: null) => void): parsed is {
|
|
6
|
-
success: true;
|
|
7
|
-
data: T;
|
|
8
|
-
};
|
|
9
|
-
export declare function parseActionPayload<T>(schema: z.ZodType<T>, rawPayload: Record<string, string> | undefined, callback: (error: grpc.ServiceError | null, value: null) => void): T | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { z } from "zod";
|
|
2
|
-
export type ParsePayloadResult<T> = {
|
|
3
|
-
success: true;
|
|
4
|
-
data: T;
|
|
5
|
-
} | {
|
|
6
|
-
success: false;
|
|
7
|
-
message: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function parsePayload<T>(schema: z.ZodType<T>, rawPayload: Record<string, string> | undefined): ParsePayloadResult<T>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as grpc from "@grpc/grpc-js";
|
|
2
|
-
export declare function stableGrpcErrorCode(message: string): grpc.status | undefined;
|
|
3
|
-
/** Maps CCXT typed errors to appropriate gRPC status codes. Returns undefined for unrecognized errors. */
|
|
4
|
-
export declare function mapCcxtErrorToGrpcStatus(error: unknown): grpc.status | undefined;
|
|
5
|
-
export declare function resolveGrpcError(error: unknown, message?: string): {
|
|
6
|
-
code: grpc.status;
|
|
7
|
-
message: string;
|
|
8
|
-
};
|
package/dist/helpers/index.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { Exchange } from "@usherlabs/ccxt";
|
|
2
|
-
import type { PolicyConfig } from "../types";
|
|
3
|
-
import { type BrokerAccount } from "./broker";
|
|
4
|
-
export { authenticateRequest } from "./auth";
|
|
5
|
-
export { applyCommonExchangeConfig, type BrokerAccount, BrokerAccountPreconditionError, type BrokerPoolEntry, createBroker, createBrokerPool, createPublicBroker, getCurrentBrokerSelector, resolveBrokerAccount, selectBroker, selectBrokerAccount, } from "./broker";
|
|
6
|
-
export { australiaDepositQuestionnaireSchema, australiaQuestionnaireSchema, getEnabledTravelRuleDepositConfig, registerBinanceTravelRuleDepositEndpoints, registerBinanceTravelRuleWithdrawEndpoint, resolveDepositOriginatorQuestionnaire, resolveTravelRuleDecision, type TravelRuleDecision, withdrawViaLocalEntity, } from "./travel-rule";
|
|
7
|
-
export { loadTravelRuleDepositReconcilerConfigFromEnv, resolveOnChainSender, TravelRuleDepositReconciler, } from "./travel-rule-deposit-reconciler";
|
|
8
|
-
export { buildHttpClientOverrideFromMetadata, createVerityHttpClientOverride, verityHttpClientOverridePredicate, } from "./verity";
|
|
9
|
-
/**
|
|
10
|
-
* Loads and validates policy configuration
|
|
11
|
-
*/
|
|
12
|
-
export declare function loadPolicy(policyPath: string): PolicyConfig;
|
|
13
|
-
export declare function normalizePolicyConfig(policy: PolicyConfig): PolicyConfig;
|
|
14
|
-
export declare function normalizeBrokerNetworkId(network: string): string;
|
|
15
|
-
export declare function validateWithdraw(policy: PolicyConfig, exchange: string, network: string, recipientAddress: string, _amount: number, ticker: string): {
|
|
16
|
-
valid: boolean;
|
|
17
|
-
error?: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Routes an internal transfer to the correct Binance SAPI endpoint
|
|
21
|
-
* based on source and destination account types.
|
|
22
|
-
*/
|
|
23
|
-
export declare function transferBinanceInternal(source: BrokerAccount, dest: BrokerAccount, code: string, amount: number): Promise<unknown>;
|
|
24
|
-
/**
|
|
25
|
-
* Validates order request against policy rules
|
|
26
|
-
*/
|
|
27
|
-
export declare function validateOrder(policy: PolicyConfig, fromToken: string, toToken: string, amount: number, broker: string): {
|
|
28
|
-
valid: boolean;
|
|
29
|
-
error?: string;
|
|
30
|
-
};
|
|
31
|
-
type OrderExecutionResolution = {
|
|
32
|
-
valid: boolean;
|
|
33
|
-
error?: string;
|
|
34
|
-
symbol?: string;
|
|
35
|
-
side?: "buy" | "sell";
|
|
36
|
-
amountBase?: number;
|
|
37
|
-
limitsApplied?: boolean;
|
|
38
|
-
matchedPatterns?: string[];
|
|
39
|
-
};
|
|
40
|
-
export declare function resolveOrderExecution(policy: PolicyConfig, broker: Exchange, cex: string, fromToken: string, toToken: string, amount: number, price: number, marketTypeInput?: unknown): Promise<OrderExecutionResolution>;
|
|
41
|
-
export declare function validateDeposit(policy: PolicyConfig, exchange: string, network: string, ticker: string): {
|
|
42
|
-
valid: boolean;
|
|
43
|
-
error?: string;
|
|
44
|
-
};
|
package/dist/helpers/logger.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { LogLayer } from "loglayer";
|
|
2
|
-
export declare function attachOtelLogTransport(): void;
|
|
3
|
-
export declare function detachOtelLogTransport(): void;
|
|
4
|
-
declare const log: {
|
|
5
|
-
trace: (...args: unknown[]) => void;
|
|
6
|
-
debug: (...args: unknown[]) => void;
|
|
7
|
-
info: (...args: unknown[]) => void;
|
|
8
|
-
warn: (...args: unknown[]) => void;
|
|
9
|
-
error: (...args: unknown[]) => void;
|
|
10
|
-
fatal: (...args: unknown[]) => void;
|
|
11
|
-
withMetadata: LogLayer["withMetadata"];
|
|
12
|
-
};
|
|
13
|
-
export { log };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { BrokerArchiveRow } from "../broker-execution-archive/types";
|
|
2
|
-
import type { NormalizedOrderBookSnapshot, OrderBookConstructionMode } from "../order-book";
|
|
3
|
-
import type { MarketCaptureContext, RawCapture } from "./types";
|
|
4
|
-
export declare class OrderBookValidationError extends Error {
|
|
5
|
-
readonly reason: string;
|
|
6
|
-
constructor(reason: string);
|
|
7
|
-
}
|
|
8
|
-
export type CanonicalOrderBookRows = {
|
|
9
|
-
snapshotId: string;
|
|
10
|
-
levels: BrokerArchiveRow[];
|
|
11
|
-
summary: BrokerArchiveRow;
|
|
12
|
-
};
|
|
13
|
-
export declare function buildCanonicalOrderBookRows(input: {
|
|
14
|
-
context: MarketCaptureContext;
|
|
15
|
-
snapshot: NormalizedOrderBookSnapshot;
|
|
16
|
-
rawCapture: RawCapture;
|
|
17
|
-
depthLimit: number;
|
|
18
|
-
measurementBandsBps?: readonly number[];
|
|
19
|
-
constructionMode?: OrderBookConstructionMode | "policy_neutral_top_n_state_change_tape/v1";
|
|
20
|
-
}): CanonicalOrderBookRows;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { BrokerArchiveSource } from "../broker-execution-archive/types";
|
|
2
|
-
import type { BrokerMarketType } from "../market-type";
|
|
3
|
-
import type { CaptureFeed, CaptureSourceMode, MarketCaptureContext } from "./types";
|
|
4
|
-
export type CaptureEnvironment = "development" | "production";
|
|
5
|
-
export declare function createMarketCaptureContext(input: {
|
|
6
|
-
source: BrokerArchiveSource;
|
|
7
|
-
deploymentId: string;
|
|
8
|
-
captureBundleId?: string;
|
|
9
|
-
exchange: string;
|
|
10
|
-
symbol: string;
|
|
11
|
-
assetType: BrokerMarketType;
|
|
12
|
-
feed: CaptureFeed;
|
|
13
|
-
provider?: string;
|
|
14
|
-
sourceMode: CaptureSourceMode;
|
|
15
|
-
timeframe?: string;
|
|
16
|
-
accountSelector?: string;
|
|
17
|
-
environment?: CaptureEnvironment;
|
|
18
|
-
}): MarketCaptureContext;
|
|
19
|
-
export type MarketCaptureArchiveDisabledReason = "archive_disabled" | "market_archive_disabled" | "invalid_capture_environment" | "missing_deployment_id" | "missing_capture_bundle_id";
|
|
20
|
-
export type MarketCaptureArchiveState = {
|
|
21
|
-
enabled: true;
|
|
22
|
-
} | {
|
|
23
|
-
enabled: false;
|
|
24
|
-
reason: MarketCaptureArchiveDisabledReason;
|
|
25
|
-
};
|
|
26
|
-
export declare function resolveMarketCaptureArchiveState(input: {
|
|
27
|
-
archiveEnabled: boolean;
|
|
28
|
-
marketArchiveEnabled: boolean;
|
|
29
|
-
environment?: string;
|
|
30
|
-
deploymentId?: string;
|
|
31
|
-
captureBundleId?: string;
|
|
32
|
-
}): MarketCaptureArchiveState;
|
|
33
|
-
/**
|
|
34
|
-
* Throws when archival was requested but its capture identity is incomplete.
|
|
35
|
-
*
|
|
36
|
-
* `archive_disabled` and `market_archive_disabled` are deliberate opt-outs and
|
|
37
|
-
* must keep the broker available — that is the whole point of resolving to a
|
|
38
|
-
* typed state instead of throwing. Every other disabled reason means archival
|
|
39
|
-
* was asked for and cannot be honoured, which is a misconfiguration: a broker
|
|
40
|
-
* started in that state serves RPC and passes health while writing no
|
|
41
|
-
* market-data row at all, and the only trace is one line at boot.
|
|
42
|
-
*/
|
|
43
|
-
export declare function assertMarketCaptureArchiveStartable(state: MarketCaptureArchiveState): void;
|
|
44
|
-
export declare function validateExternalFallbackContext(input: {
|
|
45
|
-
configuredExchange: string;
|
|
46
|
-
configuredSymbol: string;
|
|
47
|
-
rowExchange: string;
|
|
48
|
-
rowSymbol: string;
|
|
49
|
-
provider: string;
|
|
50
|
-
sourceMode: "external_ccxt_fallback_v1" | "external_hummingbot_fallback_v1";
|
|
51
|
-
fallbackReason: string;
|
|
52
|
-
}): void;
|
|
53
|
-
export declare function captureEnvironmentFromEnv(value?: string | undefined): CaptureEnvironment;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { MarketCaptureContext, RawCapture, RawCaptureScope } from "./types";
|
|
2
|
-
export declare const MARKET_CAPTURE_SCHEMA_VERSION: "1.0.0";
|
|
3
|
-
export declare const CHECKSUM_ALGORITHM: "sha256-canonical-json-v1";
|
|
4
|
-
export declare const ARCHIVE_SOURCES: readonly ["broker_read", "broker_write"];
|
|
5
|
-
export declare const MARKET_ARCHIVE_SOURCES: readonly ["broker_read", "broker_write", "external_backfill"];
|
|
6
|
-
export declare const CAPTURE_FEEDS: readonly ["ORDERBOOK", "TICKER", "TRADES", "OHLCV"];
|
|
7
|
-
export declare const SOURCE_MODES: readonly ["broker_live_stream_v1", "broker_live_sampling_v1", "broker_current_snapshot_v1", "broker_bootstrap_fetch_v1", "external_ccxt_fallback_v1", "external_hummingbot_fallback_v1", "legacy_migration_v1", "historical_vendor_orderbook_v1", "vendor_historical_backfill_v1"];
|
|
8
|
-
export declare const CONSTRUCTION_MODES: readonly ["sampled_top_n_snapshot", "exact_l2_reconstruction"];
|
|
9
|
-
export declare const GAP_POLICIES: readonly ["record_gap", "ohlcv_catch_up", "fail_fast"];
|
|
10
|
-
export declare const RAW_CAPTURE_SCOPES: readonly ["ccxt_normalized_object", "broker_visible_payload", "exchange_wire_frame", "vendor_normalized_dataset_file"];
|
|
11
|
-
export type CaptureFeed = (typeof CAPTURE_FEEDS)[number];
|
|
12
|
-
export type SourceMode = (typeof SOURCE_MODES)[number];
|
|
13
|
-
export type ConstructionMode = (typeof CONSTRUCTION_MODES)[number];
|
|
14
|
-
export type GapPolicy = (typeof GAP_POLICIES)[number];
|
|
15
|
-
/**
|
|
16
|
-
* Renders a finite JavaScript number as a plain decimal. Exponent expansion and
|
|
17
|
-
* negative-zero normalization are part of checksum algorithm v1 and are mirrored
|
|
18
|
-
* by the Python fixture verifier.
|
|
19
|
-
*/
|
|
20
|
-
export declare function canonicalDecimal(value: number): string;
|
|
21
|
-
export declare function canonicalSerialize(value: unknown): string;
|
|
22
|
-
export declare function sha256Canonical(value: unknown): string;
|
|
23
|
-
export declare function normalizeTimestampMs(value: unknown, field: string): number;
|
|
24
|
-
export declare function createRawCapture(context: MarketCaptureContext, input: {
|
|
25
|
-
payload: unknown;
|
|
26
|
-
eventTimeMs: unknown;
|
|
27
|
-
receivedTimeMs: unknown;
|
|
28
|
-
scope: RawCaptureScope;
|
|
29
|
-
}): RawCapture;
|
|
30
|
-
export declare function captureCoreFields(context: MarketCaptureContext, rawCapture: RawCapture): Record<string, unknown>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type BrokerExecutionArchiver } from "../broker-execution-archive/writer";
|
|
2
|
-
import type { OtelMetrics } from "../otel";
|
|
3
|
-
import { OhlcvBarTracker } from "./ohlcv-bar-tracker";
|
|
4
|
-
import { OrderbookSampler } from "./orderbook-sampler";
|
|
5
|
-
import type { CexStreamArchiveInput, OhlcvArchiveInput, OrderbookArchiveInput, TickerArchiveInput, TradesArchiveInput } from "./types";
|
|
6
|
-
export declare function archiveOrderbookInBackground(archiver: BrokerExecutionArchiver | undefined, otelMetrics: OtelMetrics | undefined, input: OrderbookArchiveInput, options?: {
|
|
7
|
-
sampledOut?: boolean;
|
|
8
|
-
sourceMode?: "broker_live_sampling_v1" | "broker_current_snapshot_v1";
|
|
9
|
-
depthLimit?: number;
|
|
10
|
-
}): void;
|
|
11
|
-
/** @deprecated Use archiveOrderbookInBackground */
|
|
12
|
-
export declare const archiveOrderbookSnapshotInBackground: typeof archiveOrderbookInBackground;
|
|
13
|
-
/** @deprecated Use archiveOrderbookInBackground */
|
|
14
|
-
export declare const archiveOrderbookTobInBackground: typeof archiveOrderbookInBackground;
|
|
15
|
-
export declare function archiveOhlcvInBackground(archiver: BrokerExecutionArchiver | undefined, otelMetrics: OtelMetrics | undefined, tracker: OhlcvBarTracker, input: OhlcvArchiveInput): void;
|
|
16
|
-
export declare function createOrderbookSampler(): OrderbookSampler;
|
|
17
|
-
/** @deprecated Use createOrderbookSampler */
|
|
18
|
-
export declare const createOrderbookTobSampler: typeof createOrderbookSampler;
|
|
19
|
-
export declare function createOhlcvBarTracker(): OhlcvBarTracker;
|
|
20
|
-
export declare function archiveTradesInBackground(archiver: BrokerExecutionArchiver | undefined, otelMetrics: OtelMetrics | undefined, input: TradesArchiveInput): void;
|
|
21
|
-
export declare function archiveTickerInBackground(archiver: BrokerExecutionArchiver | undefined, otelMetrics: OtelMetrics | undefined, input: TickerArchiveInput): void;
|
|
22
|
-
export declare function archiveCexStreamEventInBackground(archiver: BrokerExecutionArchiver | undefined, otelMetrics: OtelMetrics | undefined, input: CexStreamArchiveInput): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { buildCanonicalOrderBookRows, OrderBookValidationError, } from "./canonical-orderbook";
|
|
2
|
-
export { archiveCexStreamEventInBackground, archiveOhlcvInBackground, archiveOrderbookInBackground, archiveOrderbookSnapshotInBackground, archiveOrderbookTobInBackground, archiveTickerInBackground, archiveTradesInBackground, createOhlcvBarTracker, createOrderbookSampler, createOrderbookTobSampler, } from "./capture";
|
|
3
|
-
export { assertMarketCaptureArchiveStartable, captureEnvironmentFromEnv, createMarketCaptureContext, type MarketCaptureArchiveDisabledReason, type MarketCaptureArchiveState, resolveMarketCaptureArchiveState, validateExternalFallbackContext, } from "./capture-context";
|
|
4
|
-
export { ARCHIVE_SOURCES, CAPTURE_FEEDS, CHECKSUM_ALGORITHM, CONSTRUCTION_MODES, canonicalDecimal, canonicalSerialize, createRawCapture, GAP_POLICIES, MARKET_CAPTURE_SCHEMA_VERSION, RAW_CAPTURE_SCOPES, SOURCE_MODES, sha256Canonical, } from "./capture-contract";
|
|
5
|
-
export { buildLegacyOhlcvMigrationRow, buildLegacyOrderBookMigrationRows, type LegacyCandle, type LegacyOrderBookSnapshot, } from "./legacy-migration";
|
|
6
|
-
export { extractLatestOhlcvBar, extractOhlcvBars, OhlcvBarTracker, parseOhlcvBar, } from "./ohlcv-bar-tracker";
|
|
7
|
-
export { resolveOhlcvBootstrapLimit } from "./ohlcv-bootstrap";
|
|
8
|
-
export { bootstrapOhlcvHistory } from "./ohlcv-history";
|
|
9
|
-
export { getOrderbookArchiveDepthLimit, splitOrderBookSide, } from "./orderbook-depth";
|
|
10
|
-
export { getOrderbookIntervalMs, getOrderbookTobIntervalMs, isMarketArchiveEnabled, OrderbookSampler, OrderbookTobSampler, } from "./orderbook-sampler";
|
|
11
|
-
export { extractTrades, parseTicker, parseTrade } from "./parse-stream";
|
|
12
|
-
export { buildCanonicalCexStreamEventRow, buildCanonicalOhlcvRow, buildCanonicalTickerEventRow, buildCanonicalTradeRow, buildCexStreamEventRow, } from "./rows";
|
|
13
|
-
export type { CaptureFeed, CaptureSourceMode, CexStreamArchiveInput, CexStreamType, MarketArchiveContext, MarketCaptureContext, OhlcvArchiveCandidate, OhlcvArchiveInput, OrderbookArchiveInput, OrderbookSnapshotArchiveInput, OrderbookTobArchiveInput, ParsedOhlcvBar, RawCapture, RawCaptureScope, TickerArchiveInput, TradesArchiveInput, } from "./types";
|