@usherlabs/cex-broker 0.2.18 → 0.2.20
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 +22 -1
- package/dist/commands/cli.js +2692 -1263
- package/dist/handlers/execute-action/context.d.ts +2 -0
- package/dist/handlers/execute-action/handler.d.ts +2 -0
- package/dist/handlers/subscribe/handler.d.ts +2 -0
- package/dist/helpers/broker-execution-archive/capture.d.ts +27 -0
- package/dist/helpers/broker-execution-archive/index.d.ts +5 -0
- package/dist/helpers/broker-execution-archive/redact.d.ts +7 -0
- package/dist/helpers/broker-execution-archive/rows.d.ts +31 -0
- package/dist/helpers/broker-execution-archive/types.d.ts +16 -0
- package/dist/helpers/broker-execution-archive/writer.d.ts +57 -0
- package/dist/helpers/market-data-archive/capture.d.ts +20 -0
- package/dist/helpers/market-data-archive/index.d.ts +9 -0
- package/dist/helpers/market-data-archive/ohlcv-bar-tracker.d.ts +11 -0
- package/dist/helpers/market-data-archive/ohlcv-bootstrap.d.ts +1 -0
- package/dist/helpers/market-data-archive/ohlcv-history.d.ts +8 -0
- package/dist/helpers/market-data-archive/orderbook-depth.d.ts +5 -0
- package/dist/helpers/market-data-archive/orderbook-sampler.d.ts +12 -0
- package/dist/helpers/market-data-archive/parse-stream.d.ts +26 -0
- package/dist/helpers/market-data-archive/rows.d.ts +18 -0
- package/dist/helpers/market-data-archive/types.d.ts +55 -0
- package/dist/helpers/order-telemetry.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5659 -4231
- package/dist/index.js.map +26 -12
- package/dist/server.d.ts +2 -1
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -78,6 +78,27 @@ OTEL_SERVICE_NAME=cex-broker
|
|
|
78
78
|
|
|
79
79
|
**Note**: Only configure API keys for exchanges you plan to use. The system will automatically detect and initialize configured exchanges.
|
|
80
80
|
|
|
81
|
+
### Research / Backtest (ClickHouse Path B)
|
|
82
|
+
|
|
83
|
+
Archive subscribe streams (OHLCV, orderbook, trades, ticker) to ClickHouse via the **archive forwarder**, visualize candles in the browser, run Python backtests, and optionally feed Hummingbot from the same warehouse.
|
|
84
|
+
|
|
85
|
+
- **Overview:** [research/README.md](research/README.md)
|
|
86
|
+
- **Full guide:** [docs/research-backtest.md](docs/research-backtest.md)
|
|
87
|
+
|
|
88
|
+
Quick start:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
docker network create fiet-sandbox || true
|
|
92
|
+
docker compose -f docker/clickhouse-research.compose.yml up -d
|
|
93
|
+
bun run start-archive-forwarder # if not using compose forwarder service
|
|
94
|
+
SYMBOLS=BTC/USDT,BNB/USDT,DOGE/USDT bun run start-archive-watch
|
|
95
|
+
CLICKHOUSE_PORT=8123 bun run start-candle-viewer # http://localhost:8091
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Dev watchers: `dev:candle-viewer`, `dev:archive-forwarder`, `dev:archive-watch` (see [research/README.md](research/README.md)).
|
|
99
|
+
|
|
100
|
+
Key env vars: `CEX_BROKER_ARCHIVE_FORWARDER_URL`, `CEX_BROKER_MARKET_ARCHIVE_ENABLED=true`, `CEX_BROKER_DEPLOYMENT_ID`.
|
|
101
|
+
|
|
81
102
|
#### Wallet-authenticated exchanges
|
|
82
103
|
|
|
83
104
|
Some exchanges (for example Hyperliquid, Vertex, Paradex, and Derive) authenticate with an on-chain wallet instead of exchange-issued API keys. The broker keeps the same `API_KEY` / `API_SECRET` interface and maps credentials internally based on each exchange's CCXT `requiredCredentials`:
|
|
@@ -703,7 +724,7 @@ Every successful `CreateOrder` response, successful `GetOrderDetails` response,
|
|
|
703
724
|
- 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
|
|
704
725
|
- Timing: exchange timestamp when present and broker observed timestamp
|
|
705
726
|
|
|
706
|
-
Use metrics for aggregations and alerts,
|
|
727
|
+
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.*`. Setting `CEX_BROKER_ARCHIVE_OTEL_LOGS_ENABLED=true` additionally mirrors those execution rows to OTel logs for observability, but the forwarder is the sink of record; you do not need an OTLP collector with a ClickHouse exporter to capture execution rows. 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. The broker does not emit raw exchange payloads, API keys, secrets, or credentials in these telemetry fields.
|
|
707
728
|
|
|
708
729
|
### Telemetry Test Harness
|
|
709
730
|
|