Order Books
Create Order Book
Deploy a new on-chain order book for a token pair
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 thetrading service enabled. Pass the key as x-api-key header in the format trusset_{instanceRef}_{secret}.
Request Body
EVM address of the base token (the asset being traded). Must match
0x[a-fA-F0-9]{40}.EVM address of the quote token (the currency used for pricing). Must match
0x[a-fA-F0-9]{40}.Display name of the order book. 1-64 characters.
Short symbol for the trading pair. 1-16 characters.
EVM address of the custody contract for on-chain settlement. If omitted, trades require manual settlement coordination.
Minimum order size in base units (wei). Numeric string.
Maximum order size in base units (wei). Numeric string. Omit for no upper limit.
Minimum price increment in quote token base units. Numeric string.
Fee charged to makers in basis points. 0-1000 (0%-10%).
Fee charged to takers in basis points. 0-1000 (0%-10%).
Type of the base token. One of
LIGHT_TOKEN or STOCK_TOKEN. Defaults to LIGHT_TOKEN.Reference ID for stock tokens. Required when
tokenType is STOCK_TOKEN. Max 100 characters.Identifier of the underlying instrument (for example an ISIN). Exactly 12 alphanumeric characters, matching
[A-Za-z0-9]{12}.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.Matching engine mode. One of
CONTINUOUS (default), PERIODIC_AUCTION, or HYBRID.Auction clearing interval in seconds. Applies to
PERIODIC_AUCTION and HYBRID. 30-3600. Nullable.Spread threshold in basis points that switches a
HYBRID book between continuous matching and auction batching. 1-10000. Nullable.Whether orders left unmatched at the end of an auction roll forward into the next auction.
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.Enable price reference enforcement for this order book.
Source of the reference price. One of
MANUAL, STOCK_FEED, or EXTERNAL_FEED.Feed endpoint to poll when
priceRefMode is EXTERNAL_FEED. Max 2048 characters. Nullable.Headers to send with the feed request, as a serialized string (for example a JSON object of header pairs). Max 4096 characters. Nullable.
Path used to extract the price from the feed response (for example a JSON path). Max 256 characters. Nullable.
How often the reference is refreshed and enforced. One of
EVERY_TRADE, 1MIN, 5MIN, 10MIN, 30MIN, 1HOUR, 6HOUR, 12HOUR, 1DAY.Allowed band around the reference price, in basis points. Orders priced outside the band are rejected. 1-10000. Nullable.
Halt the order book when the reference price is older than
priceRefStaleTolerance.Maximum age of the reference price before it is considered stale, in seconds. 60-604800. Nullable.
Circuit breaker threshold in basis points. A reference move beyond this bound trips the breaker. 10-10000. Nullable.
