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

# Historical orders

> Order history filtered by closed status (FILLED / CANCELLED / REJECTED). Auto-queries live and archive tables across the 92-day cutover.

Order history filtered by closed status (`FILLED` / `CANCELLED` / `REJECTED`). Spans live and archive tables — windows that cross the 92-day archive cutoff are queried across both.

Includes both ordinary and algo orders (algo rows include `trigger_price` / `trigger_status`).

**Weight:** `5`

## Request

```json theme={null}
{
  "type": "historicalOrders",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "symbol": "PERP_ETH_USDC",
  "status": "FILLED",
  "start_time": 1715000000000,
  "end_time": 1715600000000,
  "limit": 100
}
```

| Field        | Type   | Required | Default                    | Notes                                                                    |
| ------------ | ------ | -------- | -------------------------- | ------------------------------------------------------------------------ |
| `address`    | string | Yes      | —                          | Wallet address                                                           |
| `broker_id`  | string | No       | —                          | Optional                                                                 |
| `account_id` | string | No       | —                          | Optional                                                                 |
| `symbol`     | string | No       | —                          | Symbol filter                                                            |
| `status`     | string | No       | all three                  | `FILLED` / `CANCELLED` (alias `CANCELED`) / `REJECTED`, case-insensitive |
| `start_time` | int64  | No       | `now (UTC day snap) − 24h` | ms epoch                                                                 |
| `end_time`   | int64  | No       | `now`                      | ms epoch                                                                 |
| `limit`      | int    | No       | 100                        | 1..500                                                                   |
| `cursor`     | string | No       | —                          | Opaque cursor                                                            |

## Response

| Field                             | Type           | Notes                                                                                                                                                                                                                                                                             |
| --------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`                            | string         | Ordinary (`LIMIT`, `MARKET`, `IOC`, `POST_ONLY`, `FOK`, `LIQUIDATE`, `BID`, `ASK`, `SETTLEMENT`) or algo (`STOP_MARKET`, `STOP_LIMIT`, `TAKE_PROFIT_MARKET`, `TAKE_PROFIT_LIMIT`, `OCO`, `TRAILING_STOP`, `BRACKET`, `POSITIONAL_TP_SL`, `TP_SL`, `STOP_TRIGGER`, `STOP_BRACKET`) |
| `status`                          | string         | `FILLED` / `CANCELLED` / `REJECTED`                                                                                                                                                                                                                                               |
| `average_executed_price`          | string \| null | `executed_amount / executed_quantity`; `null` if zero fills                                                                                                                                                                                                                       |
| `trigger_price`, `trigger_status` | string \| null | Algo rows only                                                                                                                                                                                                                                                                    |
| `realized_pnl`                    | string \| null | `null` on algo rows                                                                                                                                                                                                                                                               |
| `reduce_only`                     | bool \| null   | Algo rows only                                                                                                                                                                                                                                                                    |

## Notes

* **Status mapping:** `FILLED → [3]`, `CANCELLED → [5]`, `REJECTED → [6]`; omitting `status` queries all three
* **Default window** is UTC-day-snapped `now − 24h` — pass an explicit `start_time` for longer lookbacks
* **Archive cutoff** is 92 days. Queries spanning that boundary transparently combine live and archived orders
* Sort: `(created_time DESC, order_id DESC)`

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "rows": [
        {
          "order_id": "123456789",
          "symbol": "PERP_ETH_USDC",
          "side": "BUY",
          "type": "LIMIT",
          "price": "2128.31",
          "quantity": "164.45",
          "total_executed_quantity": "164.45",
          "average_executed_price": "2128.29",
          "trigger_price": null,
          "trigger_status": null,
          "status": "FILLED",
          "total_fee": "0.002",
          "fee_asset": "USDC",
          "realized_pnl": "100.50",
          "reduce_only": false,
          "created_time": 1714900000000,
          "updated_time": 1714901000000
        }
      ],
      "next_cursor": null
    },
    "ts": 1779269143700
  }
  ```
</ResponseExample>
