> For the complete documentation index, see [llms.txt](https://docs.asterdex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.asterdex.com/trading/perpetuals/fees-and-specs/self-trade-prevention.md).

# Self-Trade Prevention

### What Is Self-Trading? <a href="#what-is-self-trading" id="what-is-self-trading"></a>

Self-trading occurs when your own buy and sell orders match against each other in the matching engine. This can happen unintentionally when you run multiple strategies at the same time.

**How self-trading affects you:**

* **Strategy disruption** — One strategy's buy order fills against another strategy's sell order. Both sides move, yet no actual entry or exit is achieved.
* **Unnecessary fee loss** — No real gain is made, but fees are still charged on both sides.
* **Unexpected position changes** — Especially on low-liquidity pairs, self-trading can cause your position to drift from its intended target.

The **Self-Trade Prevention (STP)** feature automatically handles self-trade situations according to your preset strategy, preventing the above issues.

The **STP** will apply to **futures order**. The following are all considered self-trades: orders **within the same account**, orders between a master-account and its sub-accounts, and orders between sub-accounts under the **same master account**.

### What happens when STP is triggered?

| Strategy                        | Behavior                                                                               | Best For                                                 |
| ------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| **Cancel Maker Only** (Default) | Cancels the maker order; the taker continues to match against the next available level | Prioritizing the execution of the **taker side**         |
| **Cancel Taker Only**           | Cancels **the taker order**; the **maker order remains** on the book                   | Protecting **existing maker** orders                     |
| **Cancel Both**                 | **Cancels both orders** simultaneously                                                 | Most **conservative** — eliminates self-trading entirely |

**Reminder:** Accounts default to the **Cancel Maker Only** strategy.

### FAQs

\
Q: **Does STP affect the portion of an order that has already been filled?**\
No. STP only applies to the remaining unfilled quantity at the moment it is triggered.

Q: **What happens if I don't include the stpMode parameter when placing an order via API?**\
The system will automatically apply the account's current global STP setting.

Q: **Is STP supported for FOK orders?**\
No. Orders with timeInForce set to FOK or GTX are not subject to STP.

<br>
