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

# Orders

> How to place and modify positions

## Placing orders

When you place an order, you specify:

* **Market** - Which asset to trade
* **Direction** - Long or short
* **Size** - Position size in notional
  * **Margin** - how much margin to use
  * **Leverage** - multiplies your Margin to determine Size (between 1× and the market's maximum)
* **Limit Price** (*Optional*) - The worst price at which you're willing to execute. For longs, your order is executable when the oracle price is at or below your threshold. For shorts, at or above.
* **Stop Loss / Take Profit** (*Optional*) - Trigger prices for protective close orders attached to your position.

You can only have **one open position per market**. Orders either **open** a new position, **increase** an existing one, or **reduce/close** an existing position.

When you place an open or increase order, margin is locked and the trading fee is **pre-deducted from your deposited margin** (see [Fees and Rebates](/trading/fees-rebates)). Your order then enters the matching engine and will be filled when it matches with a counterparty. For reduce and close orders, fees are assessed at fill.

## Stop loss and take profit

You can protect a position with a **stop loss (SL)** and a **take profit (TP)**: Close orders that trigger automatically when the oracle price reaches the trigger price you set.

There are two ways to set them:

* **With your order:** Include an SL and/or TP price when placing (or modifying) an open or increase order. The SL/TP orders are created alongside your position and become active once your order starts filling.
* **On an existing position:** Add, update, or cancel SL/TP at any time while you have a pending order or an open position.

### Rules

* **One SL and one TP per position**: To change a trigger price, update the existing SL/TP order; placing a duplicate is rejected.
* **Full position size**: SL/TP orders cover your entire position. If your position size changes (increase, partial fill, partial close), the SL/TP update automatically.
* **Trigger prices must be on the correct side of the current price**:

| Order           | Long position           | Short position          |
| :-------------- | :---------------------- | :---------------------- |
| **Stop loss**   | Below the current price | Above the current price |
| **Take profit** | Above the current price | Below the current price |

### How triggers execute

For a long position, the stop loss triggers when the oracle price falls to or below your trigger price, and the take profit triggers when it rises to or above it. For a short position, the directions are mirrored.

Once triggered, the order is converted to a **market-style close**: it stays executable even if the price moves back across your trigger, and fills at the oracle price through the normal [order matching](/trading/advanced/order-matching).

### Lifecycle

* When your position fully closes, by manual close, stop loss, take profit, or liquidation, any associated SL/TP orders are cancelled automatically. Stop loss and take profit effectively act as one-cancels-the-other.
* SL/TP are reduce orders, so trading fees are assessed at fill. Placing, updating, or cancelling them costs nothing beyond gas.
* You can cancel or update an SL/TP at any time before it fills. Updated trigger prices are re-validated against the current price.

## Order states

Your order moves through these states:

| **State**            | **Meaning**                                                                                  |
| :------------------- | :------------------------------------------------------------------------------------------- |
| **Pending**          | Order is in the matching engine, waiting to be matched.                                      |
| **Partially Filled** | Part of the order has been matched; the rest remains in the matching engine.                 |
| **Fully Filled**     | The entire order has been matched. For open orders, this means you now have a full position. |
| **Cancelled**        | You cancelled the order (or the unfilled portion of a partially filled order).               |

## Adding or removing margin

You can adjust margin on open positions:

**Remove margin:** When your position has excess margin (margin above the minimum required for your leverage), you can withdraw the extra amount.

**Add margin:** When your position could use more margin (e.g., to reduce liquidation risk), you can add more.

In both cases, your position size, leverage, entry price, and PnL stay the same. Only the margin balance on the position changes.

## Cancelling orders

You can cancel any unfilled or partially filled order. When you cancel an open or increase order, your locked margin **and** the pre-deducted fee are returned to you. For partially filled orders, only the margin and fee for the unfilled portion are returned.
