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

# Order

Receive real-time updates on your orders.

* Topic: `order`
* Stream: Private (`wss://api.ekiden.fi/ws/private`)

## Authenticate

Use authentication flow described in the [Connect](./connect) page.

## Subscribe

```json theme={null}
{ "op": "subscribe", "args": ["order"], "req_id": "201001" }
```

Ack:

```json theme={null}
{ "op": "subscribed", "args": ["order"], "req_id": "201001" }
```

## Events

Messages arrive with `op: "event"`, `topic: "order"`, and `data` is an array of `Order`.

Example:

```json theme={null}
{
	"op": "event",
	"topic": "order",
	"server_ts_ms": 1731541800000,
	"data": [
		{
			"order_id": "550e8400-e29b-41d4-a716-446655440000",
			"order_link_id": null,
			"symbol": "BTC-USDC",
			"sub_account_address": "0xsubacct...",
			"price": "100200",
			"qty": "1000",
			"side": "Buy",
			"margin_mode": "Cross",
			"order_status": "New",
			"create_type": null,
			"cancel_type": null,
			"reject_reason": null,
			"avg_price": "0",
			"leaves_qty": "1000",
			"leaves_value": "100200000",
			"cum_exec_qty": "0",
			"cum_exec_value": "0",
			"cum_exec_fee": "0",
			"closed_pnl": null,
			"time_in_force": "GTC",
			"expire_time": null,
			"order_type": "Limit",
			"stop_order_type": null,
			"tpsl": null,
			"trigger": null,
			"last_price_on_created": "100150",
			"post_only": false,
			"reduce_only": false,
			"close_on_trigger": false,
			"created_time": "1731541799000",
			"updated_time": "1731541800000"
		}
	]
}
```

Field notes:

* Numeric values are encoded as strings to preserve precision.
* Times (`created_time`, `updated_time`, `expire_time`) are Unix milliseconds (encoded as strings).

### Fields

| Field                    | Type             | Notes                                                    |
| ------------------------ | ---------------- | -------------------------------------------------------- |
| order\_id                | string           | Order ID (UUID)                                          |
| order\_link\_id          | string or null   | Client-provided link id, if set                          |
| symbol                   | string           | Symbol name                                              |
| sub\_account\_address    | string           | Sub-account address                                      |
| price                    | string           | Order price                                              |
| qty                      | string           | Order quantity                                           |
| side                     | string           | `Buy` or `Sell`                                          |
| margin\_mode             | string           | `Cross` or `Isolated`                                    |
| order\_status            | string           | e.g. `New`, `PartiallyFilled`, `Filled`, `Canceled`, ... |
| create\_type             | string or null   | Create source/type                                       |
| cancel\_type             | string or null   | Cancel source/type                                       |
| reject\_reason           | string or null   | Rejection reason                                         |
| avg\_price               | string           | Average executed price                                   |
| leaves\_qty              | string           | Remaining unfilled quantity                              |
| leaves\_value            | string           | Estimated value of remaining quantity                    |
| cum\_exec\_qty           | string           | Cumulative executed quantity                             |
| cum\_exec\_value         | string           | Cumulative executed value                                |
| cum\_exec\_fee           | string           | Cumulative fees                                          |
| closed\_pnl              | string or null   | Present for close position orders (WS only)              |
| time\_in\_force          | string or object | `GTC`, `IOC`, `FOK`, `Day`, or `{"GTD": <ms>}`           |
| expire\_time             | string or null   | Expiration time for GTD orders (ms)                      |
| order\_type              | string           | `Limit` or `Market`                                      |
| stop\_order\_type        | string or null   | Stop order type if applicable                            |
| tpsl                     | object or null   | Take profit / stop loss details                          |
| trigger                  | object or null   | Conditional order details                                |
| last\_price\_on\_created | string           | Last price when created                                  |
| post\_only               | boolean          | Post-only flag                                           |
| reduce\_only             | boolean          | Reduce-only flag                                         |
| close\_on\_trigger       | boolean          | Close-on-trigger flag                                    |
| created\_time            | string           | Created time (ms)                                        |
| updated\_time            | string           | Updated time (ms)                                        |

See schema details in [AsyncAPI](../websockets/private): `Order`.
