# Enums & Constraints

## Header Enums

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

## Permission Enums

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

## Order Enums

### Basic Enums

| Field           | Allowed Values                                         | Description                                     |
| --------------- | ------------------------------------------------------ | ----------------------------------------------- |
| `side`          | `Buy`, `Sell`                                          | Order direction.                                |
| `type`          | `Market`, `Limit`                                      | Order type.                                     |
| `timeInForce`   | `DAY`, `GTC`, `OPG`, `IOC`, `FOK`, `GTX`, `GTD`, `CLS` | Limit order TIF. On-chain encoding: `0` \~ `7`. |
| `operationType` | `trade`, `deposit`, `withdraw`                         | Transaction mapping type.                       |

### Order Status (Mapped)

| Value            | Description                         |
| ---------------- | ----------------------------------- |
| `Init`           | Initial state.                      |
| `Pending`        | Recorded or processing.             |
| `New`            | Identified as new order by indexer. |
| `Partial filled` | Partially filled.                   |
| `Filled`         | Fully filled.                       |
| `Canceled`       | Canceled.                           |
| `Expired`        | Expired.                            |
| `Rejected`       | Rejected.                           |
| `Failed`         | Failed.                             |

### On-Chain Status

| Value       | Description        |
| ----------- | ------------------ |
| `placing`   | Order processing.  |
| `canceling` | Cancel processing. |

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

### operationStatus

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

### mappingStatus

Reuses order mapping status enum: `Init`, `Pending`, `New`, `Partial filled`, `Filled`, `Canceled`, `Expired`, `Rejected`, `Failed`.

## 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 adjustment.          |
| `dividend` | Dividend adjustment.       |
| `spin-off` | Spin-off adjustment.       |
| `all`      | All adjustments (default). |

## Value & Address Constraints

| Field          | Constraint                                                  |
| -------------- | ----------------------------------------------------------- |
| `stockAddress` | Must be a valid EVM address. Server converts to lowercase.  |
| `userAddress`  | Must be a valid EVM address.                                |
| `tokenAddress` | Must be a valid EVM address.                                |
| `quantity`     | Must be > 0, up to 18 decimal places.                       |
| `notional`     | Must be > 0, up to 18 decimal places.                       |
| `price`        | Must be > 0, up to 18 decimal places.                       |
| `tokenAmount`  | Must be > 0, decimal places ≤ token decimals, raw ≤ uint96. |
| `creditAmount` | Must be > 0, up to 18 decimal places, raw ≤ uint96.         |
| `deadline`     | Unix seconds, > 0 and ≤ `4294967295`.                       |
| `orderId`      | Must be bytes32 hex (64 characters) for cancel endpoints.   |
| `signature`    | 65 bytes hex for One Click enable.                          |
| `gasLimit`     | Optional; server estimates if empty or ≤ 0.                 |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.anchored.finance/trading-api-docs-en/appendix/enums.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
