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

# Enums & Constraints

## Header enums

| Field            | Allowed values                                   |
| ---------------- | ------------------------------------------------ |
| `x-api-chain-id` | `8453`, `1`, `143`, `11155111`, `10143`, `84532` |
| `x-api-p`        | `Anchored`                                       |

## Permission enums

| Field    | Values      | Description        |
| -------- | ----------- | ------------------ |
| `access` | `READ_ONLY` | GET only.          |
| `access` | `WRITABLE`  | GET, POST, DELETE. |

## Order enums

| Field           | Values                                                                              | Description                                                                                                                                                                    |
| --------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `side`          | `Buy`, `Sell`                                                                       | Direction.                                                                                                                                                                     |
| `type`          | `Market`, `Limit`                                                                   | Order type.                                                                                                                                                                    |
| `timeInForce`   | `DAY`                                                                               | Limit TIF. The contract enum includes `GTC`, `OPG`, `IOC`, `FOK`, `GTX`, `GTD`, and `CLS` for forward compatibility, but current production contracts reject non-`DAY` values. |
| `operationType` | `trade`, `deposit`, `withdraw`, `stock_deposit`, `stock_withdraw`, `deferred_repay` | Order-tx mapping type. Deferred **sells** are recorded as `trade` (they are regular orders); only debt **repay** uses `deferred_repay`.                                        |

> Production limit orders currently only accept `DAY`; other `timeInForce` values will make the order transaction revert.

### Order status (mapped)

| Value            | Description             |
| ---------------- | ----------------------- |
| `Init`           | Initial.                |
| `Pending`        | Recorded or processing. |
| `New`            | New order identified.   |
| `Partial filled` | Partial fill.           |
| `Filled`         | Filled.                 |
| `Canceled`       | Canceled.               |
| `Expired`        | Expired.                |
| `Rejected`       | Rejected.               |
| `Failed`         | Failed.                 |

### On-chain status

| Value       | Description       |
| ----------- | ----------------- |
| `placing`   | Processing.       |
| `canceling` | Cancel in flight. |

### Broker raw status

```
init, pending, failed, new, partially_filled, filled, done_for_day,
canceled, expired, replaced, pending_cancel, pending_replace, accepted,
pending_new, accepted_for_bidding, stopped, rejected, suspended, calculated
```

## Cash status

### operationStatus

| Value        | Description |
| ------------ | ----------- |
| `requested`  | Requested.  |
| `processing` | Processing. |
| `settled`    | Settled.    |
| `closed`     | Closed.     |

### mappingStatus

Same as order mapping status enum above.

## Market data enums

### K-line interval

| Value | Description |
| ----- | ----------- |
| `1m`  | 1 minute    |
| `3m`  | 3 minutes   |
| `5m`  | 5 minutes   |
| `15m` | 15 minutes  |
| `1h`  | 1 hour      |
| `1d`  | 1 day       |
| `1w`  | 1 week      |

### Adjustment type

| Value      | Description    |
| ---------- | -------------- |
| `raw`      | No adjustment. |
| `split`    | Split.         |
| `dividend` | Dividend.      |
| `spin-off` | Spin-off.      |
| `all`      | All (default). |

### Corporate action types

| Value             | Description     |
| ----------------- | --------------- |
| `reverse_splits`  | Reverse split.  |
| `forward_splits`  | Forward split.  |
| `unit_splits`     | Unit split.     |
| `stock_dividends` | Stock dividend. |
| `cash_dividends`  | Cash dividend.  |

## Value constraints

| Field          | Constraint                                                                                                                       |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `stockAddress` | Valid EVM address. Lowercased by server.                                                                                         |
| `userAddress`  | Valid EVM address.                                                                                                               |
| `tokenAddress` | Valid EVM address.                                                                                                               |
| `quantity`     | > 0 in API input. Stock order quantities must encode to an 18-decimal WAD multiple of `1e9` (broker-facing 9-decimal precision). |
| `notional`     | > 0. Market-buy USD amount must use the production USD step: `0.01` when amount is `>= 1`, or `0.0001` when amount is `< 1`.     |
| `price`        | > 0. Limit price must use the production USD step: `0.01` when price is `>= 1`, or `0.0001` when price is `< 1`.                 |
| `tokenAmount`  | > 0, decimals ≤ token decimals, raw ≤ uint96.                                                                                    |
| `creditAmount` | > 0, up to 18 decimals, raw ≤ uint96.                                                                                            |
| `deadline`     | Unix seconds, > 0, ≤ `4294967295`.                                                                                               |
| `orderId`      | bytes32 hex (64 chars) for cancel.                                                                                               |
| `signature`    | 65-byte hex for One Click enable.                                                                                                |
| `gasLimit`     | Optional; server estimates if empty or ≤ 0.                                                                                      |
