Skip to main content

Operational spec

This page is the contract for production market-maker code. It states which identifiers, credentials and rules apply together.

Invariants​

  1. Use the engine account for balances, signed actions, FIX Account(1), FIXP credentials, private streams and risk checks.
  2. Use an institutional_agent HMAC credential for Binary Order Entry, FIX, FIXP and drop-copy.
  3. Every order action carries a signed payload. HMAC or session login authenticates the transport only.
  4. A fast acknowledgement is admission, not a fill. Final state comes from the private stream, drop-copy, receipts or account reads.
  5. Read GET /api/v1/accounts/{engineAccount}/bootstrap?fresh=true before the first quote and after any risk reject.

Identifiers​

NameShapeUse for
Owner wallet20-byte addressAgent creation, owner operations
Engine account20-byte address (engineAccountHex)Balances, signed action account, FIX/FIXP, streams, nonces
Trading account id32-byte accountIdHexTrading-account management routes only
API key idspk_...SC-Key, FIX Username(553)
Order id32-byte hashCancel, 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​

SurfaceCredentialAction signature
GET /api/v1/public/*NoneNone
POST /api/v1/bsl/orders/compactinstitutional_agent HMAC or provisioned order-entry keyRequired
POST /api/v1/bsl/orders/cancel-allinstitutional_agent HMACNone
Binary Order Entry TCPEd25519 session keyPer frame
FIX 4.4, FIXPHMAC at logon or negotiateSession
/api/v1/accounts/{engineAccount}/* readsBearer or HMACNone

Nonces​

NonceFieldRule
Machine authSC-NonceUnique per credential, timestamp and nonce tuple; reuse is rejected
Actionpayload.nonceAny unused value in [nonceFloor, nonceFloor + 256); gaps and any order are allowed, not monotonic
IdempotencyIdempotency-KeySame key and body replays the response; same key and other body conflicts
Reject codeMeaningAction
nonce_below_floorPermanently staleRe-sign with nonceFloor or an unused in-window nonce
nonce_outside_windowToo far aheadWait for the floor to advance, or re-sign closer
nonce_replayedAlready usedRe-sign with another unused nonce
nonce_mismatchNot admissible for the current account stateRead 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.

RuleBehavior
ScopeExplicit legs only; it never replaces a whole market or side
Legcancel_order_id set and qty: 0 cancels only; no cancel_order_id places only
OrderLegs apply in array order; cancel precedes that leg's placement
AtomicityOne failing leg rejects the whole action; earlier cancels roll back and the nonce is not consumed
Child idsDerived from the signed payload and leg index; persist derivedOrderIds[]
AdmissionWhole-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 failurerejectCode (receipt category)
Post-only leg would crossPOST_ONLY_WOULD_CROSS
Not enough USDC or sharesINSUFFICIENT_BALANCE
Spot bid above free USDCRISK_WOULD_EXCEED_AVAILABLE_USDC
Spot ask above free base assetINSUFFICIENT_SPOT_ASSET
Price, tick, lot or size errorENGINE_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​

NeedCall
Cancel one orderSigned cancel action; Binary Order Entry TCP also needs routingMarket
Scoped cancel-allPOST /api/v1/bsl/orders/cancel-all with account and optional market, book, side
Cancel on disconnectFIX/FIXP credential flag; session-key policy on TCP
Execution replayGET /api/v1/bsl/accounts/{account}/executions?fromSeq={last_contiguous_seq+1}; dedupe by seq
ReceiptsGET /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.

EventDo
Process crashFresh bootstrap, scoped cancel-all, resume
Stream gapPause quoting, replay executions, resume when contiguous
Reject 105 or 106Reconnect and reconcile by idempotency key or sequence; never replay the frame
Reject 103 or 104Venue halted or degraded; pause instead of retrying

Protections​

ItemDetail
Self-trade preventionstp_mode on orders, FIX tag 7928: cancel_maker, cancel_taker (default), reject, skip_self
Post-onlytime_in_force: post_only on HTTP and Binary Order Entry. Not available on FIX and FIXP
ReadinessQuote only while GET /api/v1/readiness returns 200

Next steps​