@usherlabs/cex-broker 0.2.45 → 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
package/README.md
CHANGED
|
@@ -735,7 +735,7 @@ Every successful `CreateOrder` response, successful `GetOrderDetails` response,
|
|
|
735
735
|
- Execution values: requested quantity/notional, executed base quantity, executed quote quantity/cost, average execution price, filled amount, remaining amount, fee amount, fee currency, fee rate
|
|
736
736
|
- Timing: exchange timestamp when present and broker observed timestamp
|
|
737
737
|
|
|
738
|
-
Use metrics for aggregations and alerts. For the durable execution audit trail, the broker archives every order lifecycle event to `broker_execution.order_events` (and pre-order top-of-book to `broker_execution.market_metadata_snapshots`) through the **archive forwarder** — the same HTTP `/archive` → ClickHouse path used for `market_data.*`. Set `CEX_BROKER_ARCHIVE_ENABLED=true`, an explicit HTTP(S) `CEX_BROKER_ARCHIVE_FORWARDER_URL`, and a writable durable JSONL path in `CEX_BROKER_ARCHIVE_DEAD_LETTER_PATH`; startup fails if either required sink configuration is missing or invalid. In production, that path must be on persistent writable storage or a mounted volume rather than the container's ephemeral filesystem. Queue shedding, rows that remain undeliverable during shutdown, and batches the forwarder rejected on every attempt are written to that loss journal with their original `{table,row}` payload before being discarded. Replay them with `bun run archive:loss:replay --journal <path>`, which re-posts through the forwarder and reports a per-entry verdict; it is idempotent across reruns, never modifies the journal, and only archives it once every entry is terminal and the operator asserts `--broker-stopped`. When the journal lives on an encrypted enclave mount (SGX deployments), its host-side bytes are sealed ciphertext the replay tool cannot read; set `CEX_BROKER_ARCHIVE_DEAD_LETTER_EXPORT_PATH` to a path on a plain (untrusted) mount and the broker exports a boot-time plaintext snapshot of the journal there, with an adjacent `.sha256` receipt whose digest is also logged from inside the enclave for integrity comparison. The export
|
|
738
|
+
Use metrics for aggregations and alerts. For the durable execution audit trail, the broker archives every order lifecycle event to `broker_execution.order_events` (and pre-order top-of-book to `broker_execution.market_metadata_snapshots`) through the **archive forwarder** — the same HTTP `/archive` → ClickHouse path used for `market_data.*`. Set `CEX_BROKER_ARCHIVE_ENABLED=true`, an explicit HTTP(S) `CEX_BROKER_ARCHIVE_FORWARDER_URL`, and a writable durable JSONL path in `CEX_BROKER_ARCHIVE_DEAD_LETTER_PATH`; startup fails if either required sink configuration is missing or invalid. In production, that path must be on persistent writable storage or a mounted volume rather than the container's ephemeral filesystem. Queue shedding, rows that remain undeliverable during shutdown, and batches the forwarder rejected on every attempt are written to that loss journal with their original `{table,row}` payload before being discarded. Replay them with `bun run archive:loss:replay --journal <path>`, which re-posts through the forwarder and reports a per-entry verdict; it is idempotent across reruns, never modifies the journal, and only archives it once every entry is terminal and the operator asserts `--broker-stopped`. When the journal lives on an encrypted enclave mount (SGX deployments), its host-side bytes are sealed ciphertext the replay tool cannot read; set `CEX_BROKER_ARCHIVE_DEAD_LETTER_EXPORT_PATH` to a path on a plain (untrusted) mount and the broker exports a boot-time plaintext snapshot of the journal there, with an adjacent `.sha256` receipt whose digest is also logged from inside the enclave for integrity comparison. The export and receipt are published as a durable pair. A completed pair is left untouched; an export with a missing or malformed receipt fails startup instead of being silently reused. Remove both files to request a fresh snapshot. Setting `CEX_BROKER_ARCHIVE_OTEL_LOGS_ENABLED=true` additionally mirrors execution rows to OTel logs for observability, but OTel is never the archive sink of record. Analysts join Maker action rows to `broker_execution.order_events` using `maker_action_id`, `idempotency_id`, `client_order_id`, or the exchange `order_id`, then compare Maker propAMM execution price against `average_execution_price` and fees. Failed CreateOrder rows keep bounded exchange error detail in `error_message`; their telemetry-shaped `payload_json`, metrics, and ordinary telemetry logs remain redacted. The broker does not emit raw exchange payloads, API keys, secrets, or credentials in telemetry fields.
|
|
739
739
|
|
|
740
740
|
### User-stream health archive contract
|
|
741
741
|
|