> For the complete documentation index, see [llms.txt](https://docs.yfx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yfx.com/yfx-v4/trading/order-types.md).

# Order Types

## Market Orders

Market orders will be opened and closed at the price the **Keeper** retrieves from the oracles. Since it takes time for the order to be confirmed on the blockchain, the position will be opened usually within 1-5 seconds.

{% hint style="warning" %}
The executed price is calaulated based on Market Price and Price Impact.
{% endhint %}

## Limit Orders

Limit orders are trigger orders on YFX. Traders can set a specified price for a limit order. If the set price crosses the current **index price**, the limit order will be executed as a market order.

{% hint style="warning" %}
Note: Limit orders are not guaranteed to be triggered due to delays on the blockchain.
{% endhint %}

Each limit order will collect the initial margin when the order is placed. When the limit order is executed, if the position size increases, the initial margin of the limit order will be added to the position margin; if the position size is reduced, the profit and loss will be settled, and the initial margin of the limit order will be refunded.

## Take-profit and stop-loss Orders

**Take-profit and stop-loss orders(TP\&SL)** are for the entire position, and when the **index price** reaches the set trigger price, the entire position will be closed. If the direction of the overall position changes, for example, a long position becomes a short position, the original take-profit and stop-loss orders will become invalid.

After a trader successfully opens a position, he can set up take-profit and stop-loss orders by setting up two prices to take profit and stop loss. After setting the prices, they can edit them under the "Position Panel."

{% hint style="warning" %}
Note: The take-profit and stop-loss orders are not guaranteed to be triggered due to delays on the blockchain.
{% endhint %}

### For example:&#x20;

1\. Bob holds a long position in BTC. The current price is 40,000. Bob can set a take-profit order priced at 40,010 and a stop-loss order priced at 39,990.

2\. Alice holds a short position in ETH, and the current price is 4,000. Alice can set a take-profit order priced at 3,990 and a stop-loss order priced at 4,010.


---

# 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.yfx.com/yfx-v4/trading/order-types.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.
