Market-maker integration
Onboard a market-making desk, stream order book and account state, quote with batches and post-only flags, and manage rate limits and risk.
Onboard a market-making desk and operating summary
Market makers connect directly over the public REST API and WebSockets; no separate legal agreement or whitelisting is required to integrate and test on TestNet. An account owner signs in at the trading app (see Networks), completes passkey setup, deposits test collateral, and approves a scoped API key (read and trade) via the browser device-grant flow or account settings. MCP is optional and not used in the low-latency quoting loop.
Review the operating summary below before enabling automated quotes:
| Parameter | Venue behavior and desk requirement |
|---|---|
| Cancel-on-disconnect (dead-man switch) | Not provided by the server. A dropped WebSocket does not cancel resting orders; run an independent cancel path calling POST /v1/orders/batch/cancel, POST /v1/orders/{orderId}/cancel, POST /v2/orders/cancel, or POST /v2/orders/cancel-all (one symbol per call, up to 500 open orders; there is no account-wide cancel-all route). |
| Batch order limits | POST /v1/orders/batch accepts 1 to 32 limit orders per request. POST /v1/orders/batch/cancel accepts 1 to 24 named owned orders per request. |
| Rate limits | Rate limits are enforced per API key or signed-in user on authenticated routes and per client address on public routes; the published OpenAPI contract does not fix a numeric request quota. When a request exceeds the active rate window, the API returns HTTP 429 (code: "rate_limited", retryable: true, recoveryActions: ["retry_after"]). Honor the Retry-After header in seconds when present; otherwise wait for the rate window to reset before retrying with the same Idempotency-Key and clientOrderId. |
Maker fees and postOnly | GET /v1/markets and GET /v1/markets/{marketId} publish makerFeeBps and takerFeeBps (1 bps = 0.01%). Fees apply to fills rather than order placement; cancelling an unfilled remainder refunds nothing and does not reverse fees from earlier fills. postOnly: true expresses maker-only intent (post_only_would_cross if the quote would cross immediately), not a promise of a rebate, and funding on an open perpetual position is separate from trading fees. |
| Networks and test market | Integrate on TestNet using listed markets such as BTC-USDCX-PERP, then trade on MainNet, which is live with real money. Find the TestNet, MainNet and DevNet REST and WebSocket URLs on Networks. |
Verify the environment, key and market
Select the target from Networks, then read GET /v1/api-keys/current. Verify active state, principal, approved account, scope and expiry. Check account readiness and its active secure identity binding. Funding is an owner action in the app.
Read GET /v1/markets and choose a currently permitted market. Load scales, quantity and price bounds, fee fields and margin parameters from the returned metadata. Keep credentials, balances and market configuration separate for each environment. The catalogue and key-metadata examples in market data and API keys are read-only starting points.
Establish the state needed to quote
Read the book, account, positions and live open orders once. Connect a socket and subscribe to market.book, market.trades, market.price, market.funding and market.status as needed by the strategy. Mint a ticket for account.orders, account.fills, account.positions, account.balance and relevant margin/PnL channels. Wait for each acceptance and reconcile snapshots before enabling quotes.
Track public feed health separately from private account health. Rotation must produce a fresh auth_ok before expiry. On a gap or dropped private subscription, stop decisions based on cached account state and recover it. The book is a complete projected snapshot; do not add its sizes to the prior book as if they were deltas.
Validate the first trading cycle
After read-only validation, authorize trade scope and test a single post-only maker quote and cancellation on TestNet (BTC-USDCX-PERP) before sending multi-order batches. postOnly applies only to limit orders and rejects with post_only_would_cross rather than taking liquidity; reduceOnly is a separate constraint for closing inventory.
Supply a unique clientOrderId and Idempotency-Key on every command. Confirm the HTTP response, the account.orders event and any account.fills update. Later fills of a resting order arrive on account.fills with its orderId; subtract each distinct later fill quantity from the placement event’s remaining quantity to track the remainder. Then test cancelling the resting remainder with POST /v1/orders/{orderId}/cancel. Use POST /v1/orders/batch (1 to 32 limit orders) and POST /v1/orders/batch/cancel (1 to 24 named owned orders) to refresh two-sided quotes in a single call. See Order API and retries.
POST /v1/orders HTTP/1.1
Host: testnet.edel-api.xyz
Authorization: Bearer <client-held-api-key>
Content-Type: application/json
Idempotency-Key: maker-demo-place-001
{
"accountId": "your-account-id",
"marketId": "BTC-USDCX-PERP",
"clientOrderId": "maker-demo-001",
"side": "buy",
"orderType": "limit",
"price": "65000",
"quantity": "0.001",
"postOnly": true
}Read fees from the market you trade
The catalogue returns makerFeeBps and takerFeeBps for each market. One basis point is 0.01%. Fees apply to fills, not order placement; cancelling an unfilled remainder refunds nothing and does not reverse fees from earlier fills. Post-only expresses maker intent, not a promise of a rebate. Funding on an open perpetual position is separate from trading fees.
Read the current market values before estimating quote profitability. See funding and fees for the full explanation.
Plan request capacity and recovery
Reserve authenticated request capacity for orders, cancellations, ticket minting and recovery, and stream live market and account updates over a shared WebSocket connection rather than polling REST. See rate limits for 429 rate_limited handling, Retry-After and window reset behavior.
Define stop conditions for stale state, unavailable channels, credential expiry and unknown order outcomes before enabling a strategy. REST and WebSockets provide the market-making interface. MCP offers optional snapshot and command tools for AI clients; it does not replace a live feed.
Budget a fixed request window
Authenticated routes enforce a fixed-window rate limit per API key or signed-in user, and minting realtime tickets counts against the same authenticated budget. The published OpenAPI contract does not specify a fixed numeric request quota across environments; use the limit configured for your approved venue and do not assume that one network's quota applies to another.
Excess requests return HTTP 429 with code: "rate_limited", retryable: true and recoveryActions: ["retry_after"] (or route-specific codes such as pine_draft_rate_limited and backtest_rate_limited on agent strategy routes). When the response includes a Retry-After header in seconds, wait that many seconds before retrying. Otherwise wait for the rate window to reset. Retry the same request with its original Idempotency-Key and clientOrderId, and avoid synchronized retry bursts.
Unauthenticated and invalid-credential traffic is rate-limited separately by network address. Device-grant polling uses its returned intervalSeconds and slow_down behavior within the approval handshake.
Define what makes the strategy stop
Because the venue does not provide server-side cancel-on-disconnect, your strategy must enforce its own kill switch when public market feeds go stale, private account streams drop, or inventory and margin cross desk limits.
Keep spare request budget for cancellation using POST /v1/orders/batch/cancel (1 to 24 named owned orders), POST /v1/orders/{orderId}/cancel, POST /v2/orders/cancel, or POST /v2/orders/cancel-all (cancels up to 500 open orders for one required symbol; there is no account-wide form):
curl --fail-with-body --silent --request POST "$EDEL_API_URL/v1/orders/batch/cancel" \
--header "Authorization: Bearer $EDEL_API_KEY" \
--header "Content-Type: application/json" \
--header "Idempotency-Key: cancel-batch-btc-001" \
--data '{"orders":[{"accountId":"your-account-id","marketId":"BTC-USDCX-PERP","orderId":"your-order-id"}]}'Recover an unknown command without duplicating it
Retain the original request, clientOrderId, Idempotency-Key and any returned orderId. Inspect the current order and reconcile account.orders, account.fills and positions. An order-entry 503 with an unknown outcome or a transport timeout may follow acceptance. Do not automatically resubmit or use a fresh identity; take one bounded order snapshot after reconnect and reconcile the streams by the original clientOrderId. A 404 alone does not prove absence of in-flight work.
For batch operations, track results by their request index and individual order identity. Already accepted siblings remain accepted. If history lags behind live state, show that lag and use the live order endpoint for a working-order question. Keep persistence and settlement observations separate from the immediate order decision.
Plan expiry and reconnection together
Agent keys require a new owner-approved device grant when an extension is needed; there is no unattended renewal route. Plan approval before expiry so access does not lapse unexpectedly while a strategy has outstanding orders.
Realtime tickets have their own shorter lifetime. Rotate the current ticket, then authenticate the socket with the new ticket before expiresAt. Do not reuse a consumed ticket on a replacement connection. After recovery, rebuild the state needed for the strategy and only then resume. Revocation should immediately disable new commands and prompt the owner to review outstanding orders and exposure.
Monitor strategy health
Record requestId, operation name, status/error code, retry decisions, timing, logical order identity and relevant sequence positions. Monitor heartbeat age, private authentication expiry, subscription acceptance, stale channels and snapshot freshness. Redact authorization headers, API keys, connect codes, tickets and owner signing material.
Measure behavior in your authorized target environment before increasing traffic or risk limits. The public API does not provide a throughput or latency service level. Validate changes against the published contracts and in your test environment before updating a running client.
Quote from reconciled state
A quote needs current market and account state
- Step
- Decision
7 parts and 8 connections.
Read as text
- Connect or reconnect → Authenticate private access
- Authenticate private access → Read one fresh snapshot
- Read one fresh snapshot → Stream book and account state
- Stream book and account state → Fresh and within limits?
- Fresh and within limits? → Place or cancel quotes (Yes)
- Place or cancel quotes → Stream book and account state
- Fresh and within limits? → Pause new exposure (No)
- Pause new exposure → Connect or reconnect
A quoting loop needs current public prices and depth alongside private working orders, fills, exposure and available risk capacity. Track the freshness of each input separately. Pause decisions that require private account state when that state is stale, even if public market ticks continue.
Use stable order identities and reconcile fills racing a cancellation before calculating replacement quantity. A cancel/new sequence is not an atomic amendment. The public API does not provide a dead-man switch, automatic cancel-on-disconnect or a universal replay window, so plan for outstanding orders during a connection failure.
| Result | Client action |
|---|---|
| 401 unauthorized / 403 forbidden | Check the credential, scope and approved account. Stop on expiry or revocation. |
| 409 idempotency_key_conflict | Do not reuse a command key with a different body. Resolve the original attempt. |
| post_only_would_cross | Review the new book before deciding whether to submit a different quote. |
| 503 or stale account data | Pause new exposure and follow recoveryActions; do not assume resting orders disappeared. |