> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trusset.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Trade Readiness

> Check whether a book has everything it needs to trade

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

<ParamField path="orderBookId" type="string" required>Order book ID.</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="ready" type="boolean">True when `issues` is empty.</ResponseField>
    <ResponseField name="orderBookId" type="string">Order book ID.</ResponseField>
    <ResponseField name="status" type="string">`ACTIVE`, `PAUSED` or `CLOSED`.</ResponseField>
    <ResponseField name="settlementMode" type="string">`ON_CHAIN`.</ResponseField>
    <ResponseField name="tokenType" type="string">`LIGHT_TOKEN`.</ResponseField>
    <ResponseField name="custodyContract" type="string">Custody contract.</ResponseField>
    <ResponseField name="tokenAddress" type="string">Commodity token.</ResponseField>
    <ResponseField name="quoteTokenAddress" type="string">Settlement token (stablecoin).</ResponseField>

    <ResponseField name="issues" type="array">
      Outstanding problems, each with `code` and `message`. Empty when the book is ready.
    </ResponseField>

    <ResponseField name="sharedPeers" type="object">
      Peer summary for the book's fungibility class.

      <Expandable>
        <ResponseField name="enabled" type="boolean">Whether this book opted into pooling.</ResponseField>
        <ResponseField name="peerCount" type="integer">Number of eligible peers.</ResponseField>
        <ResponseField name="peerIds" type="array">Peer order book IDs.</ResponseField>
        <ResponseField name="peers" type="array">Peer summaries, each with `id`, `instanceId`, `name`, `symbol`, `tokenAddress`, `quoteTokenAddress`, `custodyContract`, `tokenType`, `status`, `underlyingIdentifier` and `cfid`.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## 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 |

<Note>
  There is no dedicated shared-peers endpoint on this venue. The `sharedPeers` block here is the read for a book's fungibility class.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/orderbooks/commodities/api/order-books/clx_ob_comm_001/readiness" \
    -H "X-API-Key: trusset_your_key_here"
  ```

  ```typescript TypeScript theme={null}
  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);
  ```
</RequestExample>

<ResponseExample>
  ```json Response - Ready theme={null}
  {
    "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"
          }
        ]
      }
    }
  }
  ```
</ResponseExample>

## 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       |
