> For the complete documentation index, see [llms.txt](https://docs.sodex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sodex.com/for-developers/api-reference/wealth-api/trading.md).

# Trading

Read which channel a fund can be traded on right now, and request an RFQ quote while that channel is `rfq`.

For escrow and CLOB funds, decide the open channel from this response. The client's local clock is not the session clock.

This endpoint does not currently expose bridge execution readiness. For a live `bridged_vault`, it may return `not found` or `closed` with `bridge_not_ready`. Use the on-chain route checks and simulation in [Bridged Vaults](https://docs.sodex.com/for-developers/developers/wealth/bridged-vaults.md#configuration). There is no `bridge` trading-status channel; the `bridge` channel in User Fund History is a separate order classification.

## Trading status

`GET /funds/{fundId}/trading-status`

```bash
curl "https://mainnet-gw.sodex.dev/api/v1/wealth/funds/CXMT/trading-status" \
  -H "Accept: application/json"
```

| Name     | Location | Type   | Required | Description                     |
| -------- | -------- | ------ | -------- | ------------------------------- |
| `fundId` | path     | string | Yes      | Case-sensitive fund identifier. |

Exactly one `channel` is active: `rfq`, `batch`, `closed`, `subscription`, or `clob`. Unused channel blocks are JSON `null`.

| Field           | Type              | Description                                            |
| --------------- | ----------------- | ------------------------------------------------------ |
| `fundId`        | string            | Fund identifier.                                       |
| `vault`         | string            | Vault address.                                         |
| `channel`       | string            | Active channel.                                        |
| `closedReason`  | string or `null`  | Why the channel is `closed`, when it is.               |
| `nextChannel`   | string or `null`  | The channel that becomes active next.                  |
| `nextChannelAt` | integer or `null` | When `nextChannel` starts.                             |
| `sessionMode`   | string            | `auto`, `force_rfq`, `force_batch`, or `force_closed`. |
| `rfq`           | object or `null`  | Set while `channel` is `rfq`.                          |
| `batch`         | object or `null`  | Vault batch window.                                    |
| `subscription`  | object or `null`  | Set while `channel` is `subscription`.                 |

`closedReason` is `pre_open`, `market_break`, `market_closed`, `session_override`, or `bridge_not_ready`.

| `rfq` field          | Type              | Description                           |
| -------------------- | ----------------- | ------------------------------------- |
| `address`            | string            | RFQ contract address.                 |
| `quotable`           | boolean           | Whether a quote can be requested.     |
| `pausedByMaker`      | boolean           | Whether the maker has paused quoting. |
| `minBuyAmount`       | string            | Minimum buy amount.                   |
| `minSellAmount`      | string            | Minimum sell amount.                  |
| `expectedDeliveryAt` | integer or `null` | Expected delivery time.               |

| `batch` field        | Type              | Description                  |
| -------------------- | ----------------- | ---------------------------- |
| `opensAt`            | integer or `null` | When the batch window opens. |
| `cutoffAt`           | integer or `null` | Request cutoff.              |
| `expectedDeliveryAt` | integer or `null` | Expected delivery time.      |

| `subscription` field  | Type    | Description           |
| --------------------- | ------- | --------------------- |
| `subscribeDeadline`   | integer | Subscribe deadline.   |
| `unsubscribeDeadline` | integer | Unsubscribe deadline. |

## RFQ quote

`POST /funds/{fundId}/rfq/quote`

Asks the market maker for an immediate buy or sell quote. Call this while the trading channel is `rfq`, then submit it with [RFQ Subscribe and Redeem](https://docs.sodex.com/for-developers/developers/wealth/rfq.md).

```bash
curl "https://mainnet-gw.sodex.dev/api/v1/wealth/funds/CXMT/rfq/quote" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"side":"buy","owner":"0x1111111111111111111111111111111111111111","payAmount":"1000000"}'
```

| Name        | Location | Type   | Required | Description                                                                       |
| ----------- | -------- | ------ | -------- | --------------------------------------------------------------------------------- |
| `fundId`    | path     | string | Yes      | Case-sensitive fund identifier.                                                   |
| `side`      | body     | string | Yes      | `buy` or `sell`. Compared case-insensitively. The stored value is lowercase.      |
| `owner`     | body     | string | Yes      | EVM address of the wallet that will sign.                                         |
| `payAmount` | body     | string | Yes      | Positive base-10 integer in raw chain units. A buy pays USDC. A sell pays shares. |

A body that is not JSON returns `invalid request body`. A rejected field returns `invalid parameter`.

A desk rejection sets `quotable` to false inside a successful envelope. `nonce`, `deadline`, and `expiresInMs` stay present at zero. Nonce `0` is that wallet's first quote. `expiresInMs` `0` is a quote that just expired.

| Field           | Type             | Description                                                                                                                     |
| --------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `quotable`      | boolean          | Whether the maker returned a fillable quote.                                                                                    |
| `reason`        | object, optional | Present when `quotable` is false. `code` is the rejection code. `detail` is the maker's original phrase and is not for display. |
| `fundId`        | string           | Fund identifier.                                                                                                                |
| `vault`         | string           | Vault address.                                                                                                                  |
| `side`          | string           | `buy` or `sell`.                                                                                                                |
| `quoteId`       | string, optional | Maker quote id.                                                                                                                 |
| `payAmount`     | string, optional | Amount the wallet pays, raw units.                                                                                              |
| `receiveAmount` | string, optional | Amount the wallet receives, raw units.                                                                                          |
| `nonce`         | integer          | Quote nonce.                                                                                                                    |
| `deadline`      | integer          | Quote deadline.                                                                                                                 |
| `signature`     | string, optional | Maker signature.                                                                                                                |
| `orderHash`     | string, optional | Order hash.                                                                                                                     |
| `usdPrice`      | string, optional | Executed per-share USDC price, markups included. The key is absent when the maker sent none.                                    |
| `expiresInMs`   | integer          | Milliseconds until the quote expires.                                                                                           |

`reason.code` is one of:

| Code                  | Meaning                                           |
| --------------------- | ------------------------------------------------- |
| `not_in_session`      | The RFQ session is not open.                      |
| `market_closed`       | The market is closed.                             |
| `halted`              | Trading is halted.                                |
| `stale_market_data`   | The maker's market data is stale.                 |
| `limit_up`            | The quote would cross the limit-up band.          |
| `limit_down`          | The quote would cross the limit-down band.        |
| `below_min_notional`  | The amount is below the maker's minimum notional. |
| `below_chain_minimum` | The amount is below the chain minimum.            |
| `over_quote_cap`      | The amount is above the quote cap.                |
| `daily_cap_reached`   | The daily cap is reached.                         |
| `small_quotes_paused` | Small quotes are paused.                          |
| `paused`              | Quoting is paused.                                |
| `maker_rejected`      | The maker rejected the request.                   |
| `vault_not_supported` | This vault is not supported for RFQ.              |
