Order Books
Get Trade Readiness
Check whether a book has everything it needs to trade
GET
/
orderbooks
/
commodities
/
api
/
order-books
/
{orderBookId}
/
readiness
curl "https://api.trusset.org/orderbooks/commodities/api/order-books/clx_ob_comm_001/readiness" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/commodities/api/order-books/${orderBookId}/readiness`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.ready) for (const i of data.issues) console.warn(i.code, i.message);
{
"success": true,
"data": {
"ready": true,
"orderBookId": "clx_ob_comm_001",
"status": "ACTIVE",
"settlementMode": "ON_CHAIN",
"tokenType": "LIGHT_TOKEN",
"custodyContract": "0xf3dac9cf19da1c95a80de890e200bc86e0c6f2da",
"tokenAddress": "0xd8f3ba9de5b7b83f66d1a7b1ad96c1a64b811ff9",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"issues": [],
"sharedPeers": {
"enabled": true,
"peerCount": 1,
"peerIds": ["clx_ob_comm_055"],
"peers": [
{
"id": "clx_ob_comm_055",
"instanceId": "inst_partner_9",
"name": "Zurich Vault Gold",
"symbol": "ZVG",
"tokenAddress": "0x1a4f27c3d0e85b6971af2c5d3e8047b19c06fa2d",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"custodyContract": "0xf3dac9cf19da1c95a80de890e200bc86e0c6f2da",
"tokenType": "LIGHT_TOKEN",
"status": "ACTIVE",
"underlyingIdentifier": null,
"cfid": "0x6b1f0d2c8a3e57941b6d0af25c8e3714b90d6f2a41c5e807396ba2d5f10c84e7"
}
]
}
}
}
Returns a readiness report for one book. Each unmet prerequisite is listed in
issues with the same error code the failing operation would raise, and ready is true only when issues is empty.
The check is that the custody contract still admits both tokens. Because that is read live, a book can become unready after creation if the custody admin removes a token.
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
ON_CHAIN.string
LIGHT_TOKEN.string
Custody contract.
string
Commodity token.
string
Settlement token (stablecoin).
array
Outstanding problems, each with
code and message. Empty when the book is ready.object
Peer summary for the book’s fungibility class.
Issue Codes
| Code | Meaning |
|---|---|
ORDER_BOOK_INACTIVE | The book is PAUSED or CLOSED |
NO_CUSTODY_CONTRACT | No custody contract is recorded. The report stops here |
BASE_TOKEN_NOT_SUPPORTED | The custody contract does not admit the commodity token |
QUOTE_TOKEN_NOT_SUPPORTED | The custody contract does not admit the settlement token |
CUSTODY_SETUP_FAILED | A custody read failed, so the prerequisite could not be confirmed |
There is no dedicated shared-peers endpoint on this venue. The
sharedPeers block here is the read for a book’s fungibility class.curl "https://api.trusset.org/orderbooks/commodities/api/order-books/clx_ob_comm_001/readiness" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/commodities/api/order-books/${orderBookId}/readiness`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.ready) for (const i of data.issues) console.warn(i.code, i.message);
{
"success": true,
"data": {
"ready": true,
"orderBookId": "clx_ob_comm_001",
"status": "ACTIVE",
"settlementMode": "ON_CHAIN",
"tokenType": "LIGHT_TOKEN",
"custodyContract": "0xf3dac9cf19da1c95a80de890e200bc86e0c6f2da",
"tokenAddress": "0xd8f3ba9de5b7b83f66d1a7b1ad96c1a64b811ff9",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"issues": [],
"sharedPeers": {
"enabled": true,
"peerCount": 1,
"peerIds": ["clx_ob_comm_055"],
"peers": [
{
"id": "clx_ob_comm_055",
"instanceId": "inst_partner_9",
"name": "Zurich Vault Gold",
"symbol": "ZVG",
"tokenAddress": "0x1a4f27c3d0e85b6971af2c5d3e8047b19c06fa2d",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"custodyContract": "0xf3dac9cf19da1c95a80de890e200bc86e0c6f2da",
"tokenType": "LIGHT_TOKEN",
"status": "ACTIVE",
"underlyingIdentifier": null,
"cfid": "0x6b1f0d2c8a3e57941b6d0af25c8e3714b90d6f2a41c5e807396ba2d5f10c84e7"
}
]
}
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
INVALID_PARAM | 400 | orderBookId is missing or longer than 100 characters |
ORDER_BOOK_NOT_FOUND | 404 | No such commodity 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/commodities/api/order-books/clx_ob_comm_001/readiness" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/commodities/api/order-books/${orderBookId}/readiness`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.ready) for (const i of data.issues) console.warn(i.code, i.message);
{
"success": true,
"data": {
"ready": true,
"orderBookId": "clx_ob_comm_001",
"status": "ACTIVE",
"settlementMode": "ON_CHAIN",
"tokenType": "LIGHT_TOKEN",
"custodyContract": "0xf3dac9cf19da1c95a80de890e200bc86e0c6f2da",
"tokenAddress": "0xd8f3ba9de5b7b83f66d1a7b1ad96c1a64b811ff9",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"issues": [],
"sharedPeers": {
"enabled": true,
"peerCount": 1,
"peerIds": ["clx_ob_comm_055"],
"peers": [
{
"id": "clx_ob_comm_055",
"instanceId": "inst_partner_9",
"name": "Zurich Vault Gold",
"symbol": "ZVG",
"tokenAddress": "0x1a4f27c3d0e85b6971af2c5d3e8047b19c06fa2d",
"quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"custodyContract": "0xf3dac9cf19da1c95a80de890e200bc86e0c6f2da",
"tokenType": "LIGHT_TOKEN",
"status": "ACTIVE",
"underlyingIdentifier": null,
"cfid": "0x6b1f0d2c8a3e57941b6d0af25c8e3714b90d6f2a41c5e807396ba2d5f10c84e7"
}
]
}
}
}
