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

# Self-Trade Prevention

> How Phoenix handles orders that would match against your own liquidity

Phoenix has explicit self-trade prevention modes at the matching-engine layer.

## Available behaviors

| Behavior | What happens |
| - | - |
| `Abort` | Reject the self-cross instead of matching it |
| `CancelProvide` | Cancel the resting provide-side order on the self-cross |
| `DecrementTake` | Reduce the incoming take-side quantity by the self-cross amount |

## Default behavior

For the core limit and IOC builders, the protocol defaults to `CancelProvide` unless the caller explicitly chooses another behavior.

Some specialized flows use stricter defaults. For example:

* many SDK examples use `Abort`
* TP/SL-triggered orders are designed to avoid accidental self-matching

## Why this matters

Without STP, a trader could:

* fill against their own resting order
* pay fees for a meaningless self-match
* distort fill history and realized PnL

## User-facing outcomes

If a self-cross is detected, you may see:

* an order reject
* a resting order cancellation
* an incoming order that fills less than its original requested size

Those are not random outcomes. They depend on the selected STP mode.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.