Skip to main content
POST
Creates a new on-chain order book that pairs a stock token with a quote token. The order book settles trades through a custody contract on-chain. Both tokenAddress and quoteTokenAddress must reference deployed, registered tokens within the instance. The custody contract handles escrow during the settlement lifecycle. Order books support three matching modes (continuous, periodic auction, and hybrid) and an optional price reference layer that bounds execution prices against an external or manual reference. Both are configured at creation and can be adjusted later with Update Order Book.

Authentication

Requires an instance API key with the trading service enabled. Pass the key as x-api-key header in the format trusset_{instanceRef}_{secret}.

Request Body

tokenAddress
string
required
EVM address of the base token (the asset being traded). Must match 0x[a-fA-F0-9]{40}.
quoteTokenAddress
string
required
EVM address of the quote token (the currency used for pricing). Must match 0x[a-fA-F0-9]{40}.
name
string
required
Display name of the order book. 1-64 characters.
symbol
string
required
Short symbol for the trading pair. 1-16 characters.
custodyContract
string
EVM address of the custody contract for on-chain settlement. If omitted, trades require manual settlement coordination.
minOrderSize
string
Minimum order size in base units (wei). Numeric string.
maxOrderSize
string
Maximum order size in base units (wei). Numeric string. Omit for no upper limit.
tickSize
string
Minimum price increment in quote token base units. Numeric string.
makerFeeBps
integer
Fee charged to makers in basis points. 0-1000 (0%-10%).
takerFeeBps
integer
Fee charged to takers in basis points. 0-1000 (0%-10%).
tokenType
string
Type of the base token. One of LIGHT_TOKEN or STOCK_TOKEN. Defaults to LIGHT_TOKEN.
stockTokenId
string
Reference ID for stock tokens. Required when tokenType is STOCK_TOKEN. Max 100 characters.
underlyingIdentifier
string
Identifier of the underlying instrument (for example an ISIN). Exactly 12 alphanumeric characters, matching [A-Za-z0-9]{12}.
allowImport
boolean
Whether other instances can import this order book for cross-instance trading. Defaults to false.

Trading Mode (Hybrid Order Books)

These fields control the matching engine. Continuous books match orders on arrival; periodic auction books batch orders and clear at fixed intervals; hybrid books switch between the two based on live spread.
tradingMode
string
Matching engine mode. One of CONTINUOUS (default), PERIODIC_AUCTION, or HYBRID.
auctionIntervalSeconds
integer
Auction clearing interval in seconds. Applies to PERIODIC_AUCTION and HYBRID. 30-3600. Nullable.
hybridSwitchSpreadBps
integer
Spread threshold in basis points that switches a HYBRID book between continuous matching and auction batching. 1-10000. Nullable.
auctionRollUnmatched
boolean
Whether orders left unmatched at the end of an auction roll forward into the next auction.
mmMakerRebateBps
integer
Maker rebate paid to registered market makers, in basis points. -1000 to 1000 (negative values charge makers). Nullable.

Price Reference

When enabled, the price reference layer bounds order and trade prices to a band around a reference price. Stale or out-of-band conditions can halt the book or reject orders.
priceRefEnabled
boolean
Enable price reference enforcement for this order book.
priceRefMode
string
Source of the reference price. One of MANUAL, STOCK_FEED, or EXTERNAL_FEED.
priceRefFeedUrl
string
Feed endpoint to poll when priceRefMode is EXTERNAL_FEED. Max 2048 characters. Nullable.
priceRefFeedHeaders
string
Headers to send with the feed request, as a serialized string (for example a JSON object of header pairs). Max 4096 characters. Nullable.
priceRefFeedPath
string
Path used to extract the price from the feed response (for example a JSON path). Max 256 characters. Nullable.
priceRefEnforcement
string
How often the reference is refreshed and enforced. One of EVERY_TRADE, 1MIN, 5MIN, 10MIN, 30MIN, 1HOUR, 6HOUR, 12HOUR, 1DAY.
priceRefSpreadBps
integer
Allowed band around the reference price, in basis points. Orders priced outside the band are rejected. 1-10000. Nullable.
priceRefHaltOnStale
boolean
Halt the order book when the reference price is older than priceRefStaleTolerance.
priceRefStaleTolerance
integer
Maximum age of the reference price before it is considered stale, in seconds. 60-604800. Nullable.
priceRefCircuitBreakerBps
integer
Circuit breaker threshold in basis points. A reference move beyond this bound trips the breaker. 10-10000. Nullable.

Error Codes