> For the complete documentation index, see [llms.txt](https://docs.sai.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sai.fun/learn/trading/executing-trades.md).

# Executing Trades

## Order types

| Order Type                              | Description                                                                                                                                                                                |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Market Order**                        | Executes at the current market price (from the oracle + potential slippage). It’s the fastest way to enter a position.                                                                     |
| **Limit Order**                         | Executes only if the market crosses a specific “better” price. Example: “Go long at 50k” (the price is 51k now, so if it dips to 50k, it triggers a buy).                                  |
| **Stop Order**                          | Executes if the market crosses a specific “worse” price. Example: "Go long at 70k” (the price is 60k now; you want to catch momentum going upward).                                        |
| Trigger Order (Stop Loss / Take Profit) | Separate from entry orders—these are conditions to **close** a position automatically if price hits a threshold. A network “keeper” must send the final transaction to trigger your order. |

> **Tip**: Market, Limit, and Stop are used for **opening** a position. A Stop Loss or Take Profit is used for **closing** a position once conditions are met.

## Open a Position

1. **Choose Market & Collateral**
   * E.g., BTC/USD with “USDC” as collateral.
2. **Select a side**
   * E.g., long/short
3. **Select Leverage**
   * Type your desired multiple. The allowed range depends on the market.
   * For scheduled markets, high leverage can be reduced later by the after-hours effective leverage cap if the position is carried through a market close.
4. **Enter Order Type**
   * Market or set a limit/stop price.
5. **Confirm**
   * The contract checks your collateral, calculates fees, and *if valid*, opens your position.

**Step-by-Step Example (Market Order, Long)**

1. **Collateral**: 500 USDC (You deposit 500 tokens into the vault).
2. **Leverage**: 5x => Position Notional = 2,500 UUSD.
3. **Click “Open Long”**
   * The protocol takes your 500 collateral, checks everything, and opens a 2,500 notional BTC/USD position at the current price (minus any slippage).
4. **Fees**: Suppose 0.1% open fee => 2.5 USDC is deducted from your margin.

## Close a Position

You can fully or partially close.

* **Market Close**: Sells (or buys back) instantly at the current price.
* **Partial Close**: Specify how much leverage/collateral to remove.
* **Trigger Close** (Stop Loss / Take Profit): If price crosses your chosen threshold, a keeper can finalize the close.

**Closing Fees** apply, so plan for that. If your trade was profitable, leftover profits are credited from the vault to your wallet. If the trade was a loss, your collateral will be reduced accordingly.

## Stop Loss & Take Profit

After opening a trade, you may set or update:

* **SL**: The price to close if the market moves against you.
* **TP**: The price to close if the market moves in your favor.

Once triggered, an external call to “TriggerTrade” finalizes it. If no one triggers it, the position remains open.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.sai.fun/learn/trading/executing-trades.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
