# Self-trade Prevention

Self-trade protection (STP) prevents you from trading against your own orders, helping you avoid unnecessary fees and maintain your position in the order book.

## Why Use Self-Trade Protection?

Without STP, you might accidentally:

* Match your own orders and pay fees on both sides
* Lose your queue priority in the order book
* Create wash trades that don't represent real market activity
* Waste gas on trades that don't change your net position

## STP Modes

### 🚫 NONE

* **Behavior**: Allows self-trades without any restrictions
* **Use case**: When you specifically want to allow trading against your own orders
* **Effect**: Orders from the same address can match against each other

### ⚠️ EXPIRE\_MAKER (default)

* **Behavior**: Cancels your resting maker order when a self-trade would occur
* **Use case**: When you want your new taker order to have priority
* **Effect**:
  * Your existing maker order is cancelled and remaining collateral is refunded (for buy orders, remaining quote refund is derived from filled×price rather than any persisted quote-filled tracker)
  * Your new taker order continues to match against other orders in the book
  * You avoid paying fees on self-trades

### ⏭️ SKIP

* **Behavior**: Skips over your own orders during matching
* **Use case**: When you want to preserve all your orders in the book
* **Effect**:
  * Both orders remain active
  * The matching engine skips your own orders and continues to the next best price
  * You maintain your queue position for both orders

## How It Works

When you place an order, the matching engine checks if any potential matches are from the same address. Based on your STP setting:

1. **NONE**: Proceeds with the match normally
2. **EXPIRE\_MAKER**: Removes your maker order and continues matching
3. **SKIP**: Ignores your order and looks for the next best match


---

# Agent Instructions: 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:

```
GET https://world-book.gitbook.io/worldbook/spot-trading/self-trade-prevention.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
