Market-Making Workflows
Use a dedicated subaccount for each independent strategy. Separate quote generation, execution, risk monitoring, and reconciliation so a reconnect or slow market-data consumer can pause quoting cleanly.
Start a Session
Section titled “Start a Session”- Read the strategy account, exchange capabilities, fee rates, and request budgets.
- Confirm settled collateral and active allocations for the target exchange.
- Subscribe to its book and wait for the initial snapshot.
- Authenticate private streams for orders, fills, positions, and risk.
- Reconcile open orders and inventory before sending new quotes.
- Arm the account’s dead-man switch and maintain its refresh timer.
For example, use Binance/USDT books for a Binance strategy and Hyperliquid/USDC books for a Hyperliquid strategy. Each has its own margin, funding, and exchange state.
Quote with Explicit Constraints
Section titled “Quote with Explicit Constraints”Use ordinary GTC limit orders with post_only: true. Route directly for exchange-specific queue control. Assign a client order ID containing the strategy and quote generation, and set self-trade prevention explicitly.
{ "account_id": "acct_example_mm", "client_order_id": "hl-bid-0042", "instrument": "BTC-PERP", "settlement_asset": "USDC", "side": "buy", "type": "limit", "quantity": "0.05000", "limit_price": "76995", "time_in_force": "GTC", "post_only": true, "reduce_only": false, "routing": "direct", "venue_policy": { "allowed": ["hyperliquid"] }, "self_trade_prevention": "cancel_newest"}Use batches when submitting several quotes. Each result is independent. Update inventory from fills and reconcile order state by revision.
Amend and Retire Quotes
Section titled “Amend and Retire Quotes”Amend with the last observed expected_revision. A fill can arrive before the amendment reaches the exchange, so handle revision conflicts by reading current state. A price change can lose queue priority. Cancel obsolete quotes and wait for final remaining quantities before replacing uncertain orders.
Refresh the Dead-Man Switch
Section titled “Refresh the Dead-Man Switch”import { request } from './rest-client.mjs';import { randomUUID } from 'node:crypto';
async function refreshProtection() { return request('PUT', '/v1/account/dead-man-switch', { account_id: 'acct_example_mm', timeout_seconds: 60, }, randomUUID());}// Call before quoting, then on a timer below half the timeout.const protection = await refreshProtection();console.log(protection.expires_at);A fresh key refreshes the deadline. Replaying the old idempotency key returns its original expiry. The switch covers all open orders in that account, so coordinate it through one strategy supervisor. Expiry requests cancellations; continue reconciliation until exchanges acknowledge them.
Connectivity and Co-Location
Section titled “Connectivity and Co-Location”Place execution processes near the exchange connections enabled for the account. Request available regions and co-location arrangements through the Market Maker Program. Measure round-trip acknowledgement time, time to first fill, and market-data age separately. Network proximity is one part of the full execution path.
Keep kill conditions explicit: stale book, sequence gap, unavailable exchange, margin warning, unexpected inventory, or repeated order rejection. Pause quotes, cancel open exposure-increasing orders, and restore state before resuming.