Order Books
Get Trade Readiness
Check whether a book has everything it needs to trade
GET
/
orderbooks
/
stocks
/
api
/
order-books
/
{orderBookId}
/
readiness
curl "https://api.trusset.org/orderbooks/stocks/api/order-books/clx_ob_stock_002/readiness" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/stocks/api/order-books/${orderBookId}/readiness`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.ready) {
for (const issue of data.issues) console.warn(issue.code, issue.message);
}
{
"success": true,
"data": {
"ready": true,
"orderBookId": "clx_ob_stock_002",
"status": "ACTIVE",
"settlementMode": "ON_CHAIN",
"tokenType": "STOCK_TOKEN",
"custodyContract": "0x98c33b10823172e62a31d6048773df1054c4f821",
"tokenAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"issues": [],
"sharedPeers": { "enabled": false, "peerCount": 0, "peerIds": [], "peers": [] }
}
}
{
"success": true,
"data": {
"ready": false,
"orderBookId": "clx_ob_stock_001",
"status": "ACTIVE",
"settlementMode": "OFF_CHAIN",
"tokenType": "STOCK_TOKEN",
"custodyContract": null,
"tokenAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"issues": [
{ "code": "WRONG_SETTLEMENT_MODE", "message": "Not an on-chain orderbook" }
]
}
}
Returns a readiness report for one book. Each unmet prerequisite is listed in
issues with the same error code the failing operation would have raised, and ready is true only when issues is empty.
The checks are the on-chain custody prerequisites, so an off-chain book short-circuits: it reports WRONG_SETTLEMENT_MODE and returns immediately, because there is nothing on chain to verify. That is expected, not a fault. Off-chain books trade through Submit Off-Chain Order.
Path Parameters
string
required
Order book ID.
Response Fields
object
Show child attributes
Show child attributes
boolean
True when
issues is empty.string
Order book ID.
string
ACTIVE, PAUSED or CLOSED.string
OFF_CHAIN or ON_CHAIN.string
STOCK_TOKEN.string
Custody contract, or
null.string
Base token.
string
Quote token.
array
Issue Codes
| Code | Meaning |
|---|---|
ORDER_BOOK_INACTIVE | The book is PAUSED or CLOSED |
WRONG_SETTLEMENT_MODE | The book settles off-chain, so no custody checks apply. The report stops here |
NO_CUSTODY_CONTRACT | An on-chain book with no custody contract recorded. The report stops here |
BASE_TOKEN_NOT_SUPPORTED | The custody contract does not admit the base token |
QUOTE_TOKEN_NOT_SUPPORTED | The custody contract does not admit the quote token |
CUSTODY_NOT_AUTHORIZED | The stock token has not allow-listed the custody contract |
CUSTODY_SETUP_FAILED | A custody read failed, so the prerequisite could not be confirmed |
curl "https://api.trusset.org/orderbooks/stocks/api/order-books/clx_ob_stock_002/readiness" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/stocks/api/order-books/${orderBookId}/readiness`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.ready) {
for (const issue of data.issues) console.warn(issue.code, issue.message);
}
{
"success": true,
"data": {
"ready": true,
"orderBookId": "clx_ob_stock_002",
"status": "ACTIVE",
"settlementMode": "ON_CHAIN",
"tokenType": "STOCK_TOKEN",
"custodyContract": "0x98c33b10823172e62a31d6048773df1054c4f821",
"tokenAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"issues": [],
"sharedPeers": { "enabled": false, "peerCount": 0, "peerIds": [], "peers": [] }
}
}
{
"success": true,
"data": {
"ready": false,
"orderBookId": "clx_ob_stock_001",
"status": "ACTIVE",
"settlementMode": "OFF_CHAIN",
"tokenType": "STOCK_TOKEN",
"custodyContract": null,
"tokenAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"issues": [
{ "code": "WRONG_SETTLEMENT_MODE", "message": "Not an on-chain orderbook" }
]
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
INVALID_PARAM | 400 | orderBookId is missing or longer than 100 characters |
ORDER_BOOK_NOT_FOUND | 404 | No such stock book on this instance, and not imported |
SERVICE_NOT_ENABLED | 403 | The Trading service is not enabled on this instance |
⌘I
curl "https://api.trusset.org/orderbooks/stocks/api/order-books/clx_ob_stock_002/readiness" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/stocks/api/order-books/${orderBookId}/readiness`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.ready) {
for (const issue of data.issues) console.warn(issue.code, issue.message);
}
{
"success": true,
"data": {
"ready": true,
"orderBookId": "clx_ob_stock_002",
"status": "ACTIVE",
"settlementMode": "ON_CHAIN",
"tokenType": "STOCK_TOKEN",
"custodyContract": "0x98c33b10823172e62a31d6048773df1054c4f821",
"tokenAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"issues": [],
"sharedPeers": { "enabled": false, "peerCount": 0, "peerIds": [], "peers": [] }
}
}
{
"success": true,
"data": {
"ready": false,
"orderBookId": "clx_ob_stock_001",
"status": "ACTIVE",
"settlementMode": "OFF_CHAIN",
"tokenType": "STOCK_TOKEN",
"custodyContract": null,
"tokenAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"issues": [
{ "code": "WRONG_SETTLEMENT_MODE", "message": "Not an on-chain orderbook" }
]
}
}
