This page is the contract for production market-maker code. It states which identifiers, credentials and rules apply together.
Invariants
- Use the engine account for balances, signed actions, FIX
Account(1), FIXP credentials, private streams and risk checks.
- Use an
institutional_agent HMAC credential for Binary Order Entry, FIX, FIXP and drop-copy.
- Every order action carries a signed payload. HMAC or session login authenticates the transport only.
- A fast acknowledgement is admission, not a fill. Final state comes from the private stream, drop-copy, receipts or account reads.
- Read
GET /api/v1/accounts/{engineAccount}/bootstrap?fresh=true before the first quote and after any risk reject.
Identifiers
| Name | Shape | Use for |
|---|
| Owner wallet | 20-byte address | Agent creation, owner operations |
| Engine account | 20-byte address (engineAccountHex) | Balances, signed action account, FIX/FIXP, streams, nonces |
| Trading account id | 32-byte accountIdHex | Trading-account management routes only |
| API key id | spk_... | SC-Key, FIX Username(553) |
| Order id | 32-byte hash | Cancel, replace, reconciliation |
Resolve the engine account with GET /api/v1/trading/accounts?owner=0x.... The main account's engine account equals the owner wallet.
Authentication
| Surface | Credential | Action signature |
|---|
GET /api/v1/public/* | None | None |
POST /api/v1/bsl/orders/compact | institutional_agent HMAC or provisioned order-entry key | Required |
POST /api/v1/bsl/orders/cancel-all | institutional_agent HMAC | None |
| Binary Order Entry TCP | Ed25519 session key | Per frame |
| FIX 4.4, FIXP | HMAC at logon or negotiate | Session |
/api/v1/accounts/{engineAccount}/* reads | Bearer or HMAC | None |
Nonces
| Nonce | Field | Rule |
|---|
| Machine auth | SC-Nonce | Unique per credential, timestamp and nonce tuple; reuse is rejected |
| Action | payload.nonce | Any unused value in [nonceFloor, nonceFloor + 256); gaps and any order are allowed, not monotonic |
| Idempotency | Idempotency-Key | Same key and body replays the response; same key and other body conflicts |
| Reject code | Meaning | Action |
|---|
nonce_below_floor | Permanently stale | Re-sign with nonceFloor or an unused in-window nonce |
nonce_outside_window | Too far ahead | Wait for the floor to advance, or re-sign closer |
nonce_replayed | Already used | Re-sign with another unused nonce |
nonce_mismatch | Not admissible for the current account state | Read bootstrap or account state, re-sign |
Changing only the Idempotency-Key never fixes a nonce reject. GET /api/v1/accounts/{engineAccount} returns nonceFloor, nonceHoles and nextNonce.
Quote refresh
QuoteReplace (outcome markets, legs carry book) and SpotQuoteReplace (spot) are one signed parent action with several legs. Submit batches with POST /api/v1/bsl/orders/compact.
| Rule | Behavior |
|---|
| Scope | Explicit legs only; it never replaces a whole market or side |
| Leg | cancel_order_id set and qty: 0 cancels only; no cancel_order_id places only |
| Order | Legs apply in array order; cancel precedes that leg's placement |
| Atomicity | One failing leg rejects the whole action; earlier cancels roll back and the nonce is not consumed |
| Child ids | Derived from the signed payload and leg index; persist derivedOrderIds[] |
| Admission | Whole-batch failures (auth, schema, nonce window, rate limit, closed market) return acceptedActions: 0 |
After admission, each action in a batch succeeds or is dropped on its own. Put bids and asks in separate actions if one side may lack inventory.
| Leg failure | rejectCode (receipt category) |
|---|
| Post-only leg would cross | POST_ONLY_WOULD_CROSS |
| Not enough USDC or shares | INSUFFICIENT_BALANCE |
| Spot bid above free USDC | RISK_WOULD_EXCEED_AVAILABLE_USDC |
| Spot ask above free base asset | INSUFFICIENT_SPOT_ASSET |
| Price, tick, lot or size error | ENGINE_REJECTED |
rejectCode is the receipt category and is upper case. The matching error.code values are in the Error model.
Price is in micro units (100000 = 0.100000). Outcome prices are at most 1.000. A bid needs floor(price * qty / 1,000,000) micro USDC plus fees.
Cancel and recovery
| Need | Call |
|---|
| Cancel one order | Signed cancel action; Binary Order Entry TCP also needs routingMarket |
| Scoped cancel-all | POST /api/v1/bsl/orders/cancel-all with account and optional market, book, side |
| Cancel on disconnect | FIX/FIXP credential flag; session-key policy on TCP |
| Execution replay | GET /api/v1/bsl/accounts/{account}/executions?fromSeq={last_contiguous_seq+1}; dedupe by seq |
| Receipts | GET /api/v1/bsl/receipts?account={account}&seqs={seqs} |
A cancel-all response is an acknowledgement. Confirm terminal state from the stream, receipts or GET /api/v1/accounts/{engineAccount}/orders.
| Event | Do |
|---|
| Process crash | Fresh bootstrap, scoped cancel-all, resume |
| Stream gap | Pause quoting, replay executions, resume when contiguous |
| Reject 105 or 106 | Reconnect and reconcile by idempotency key or sequence; never replay the frame |
| Reject 103 or 104 | Venue halted or degraded; pause instead of retrying |
Protections
| Item | Detail |
|---|
| Self-trade prevention | stp_mode on orders, FIX tag 7928: cancel_maker, cancel_taker (default), reject, skip_self |
| Post-only | time_in_force: post_only on HTTP and Binary Order Entry. Not available on FIX and FIXP |
| Readiness | Quote only while GET /api/v1/readiness returns 200 |
Next steps