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

# Orders

### **REST Endpoints**

* **Get Order History**: `GET /api/v1/order/history`
* **Get Realtime Orders**: `GET /api/v1/order/realtime`
* **Place Order**: `POST /api/v1/order/place`
* **Place Batch Orders**: `POST /api/v1/order/place-batch`
* **Amend Order**: `POST /api/v1/order/amend`
* **Amend Batch Orders**: `POST /api/v1/order/amend-batch`
* **Cancel Order**: `POST /api/v1/order/cancel`
* **Cancel Batch Orders**: `POST /api/v1/order/cancel-batch`
* **Cancel All Orders**: `POST /api/v1/order/cancel-all`

### Order types and Time-in-Force

This section describes all supported order types for entries and how Time-in-Force (TIF) affects execution. Entry orders support two base types; conditional entries and bracket exits extend these with triggers.

#### Entry orders

* Market
  * `order_type: "Market"`
  * Executes immediately against the order book at the best available prices.
  * Any unfilled remainder does not rest on the book; pair with `time_in_force: "IOC"` or `"FOK"` to enforce stricter behavior explicitly.
* Limit
  * `order_type: "Limit"`
  * Executes up to the specified `price`; any unfilled remainder can rest on the book depending on TIF.
  * Common pairings: `time_in_force: "GTC"` to rest, `"IOC"` to cancel any remainder, or `"FOK"` to require full fill.
  * If the order should only add liquidity, set `post_only: true`; the order is rejected if it would execute immediately. Set `post_only: false` if post-only behavior is not required.

Recommended: set `time_in_force` explicitly for clarity rather than relying on implicit defaults.

#### Time-in-Force

* GTC — Good-Till-Cancelled. Rests until filled or cancelled.
* IOC — Immediate-Or-Cancel. Fills as much as possible immediately and cancels any unfilled remainder.
* FOK — Fill-Or-Kill. Either fills completely immediately or is cancelled.
* GTD — Good-Till-Date. Remains active until the specified expiration time, unless filled or cancelled earlier.

Provide `time_in_force` using one of the supported values:

* `"GTC"`
* `"IOC"`
* `"FOK"`
* `{ "GTD": <timestamp> }`

Post-only behavior is controlled separately using the `post_only` boolean field:

* `post_only: true` — the order only adds liquidity and is rejected if it would execute immediately.
* `post_only: false` — post-only behavior is not required.

#### Conditional entries (stop orders)

You can create a stop-style entry by supplying a `trigger` object.

The `trigger` object includes:

* `trigger_by`: Price source used to activate the order. Supported values: `"LastPrice"`, `"IndexPrice"`, or `"MarkPrice"`.
* `trigger_direction`: Direction in which the trigger condition is evaluated. Supported values: `"Up"` or `"Down"`.
* `trigger_price`: Price level that activates the order.
* Stop-Market
  * `order_type: "Market"` +`trigger`
  * Activates when the selected price source reaches the specified `trigger_price` in the specified `trigger_direction`.
* Stop-Limit
  * `order_type: "Limit"` + `trigger` +  `price`
  * Activates when the selected price source reaches the specified `trigger_price` in the specified `trigger_direction`; places a limit order at `price` on activation.

#### Order placement results and status updates

Single-order placement does not return a final order result in the REST response. Track order status updates through the private WebSocket order stream.

Batch order placement returns per-request result information in `exit_info`, including `Success` or `Error`, together with order identifiers in `result`.

### Triggers and TP/SL

* **Order field: `trigger`**
  * Makes the order conditional.
  * Structure:
    * `trigger_by`: `"LastPrice"`, `"IndexPrice"`, or `"MarkPrice"` — the price source used to activate the order.
    * `trigger_direction`: `"Up"` or `"Down"` — the trigger direction.
    * `trigger_price`: The price level at which the order is activated.
* **Order field: `tpsl`**
* Attaches Take Profit and/or Stop Loss settings to an entry order.
* Structure:
  * `mode`: `"Full"` or `"Partial"`.
  * `take_profit` / `stop_loss`: Optional TP/SL settings that support `market` or `limit` order types.
* **Reduce-only**
  * Use `reduce_only: true` to prevent increasing exposure. Triggered bracket legs always enforce reduce-only.

See the dedicated page: TP/SL, Triggers, and Reduce-Only.
