1 min read

Self-trade prevention

Self-trade prevention stops your own orders from matching against each other. It mostly matters for market makers who keep both bids and offers on the same book.

Why it matters

If your own buy order matched your own sell order, you'd pay fees on both sides for moving USDC from one pocket to the other. The result is a real on-chain trade with no economic value to you and a real fee charged by the platform.

Default web behaviour

The web trading panel does not force a self-trade prevention mode. If two of your orders cross, neither is auto-cancelled — it's on you to manage your own book.

For most retail traders this is fine, because you only have one order in flight at a time.

API options (for bots and market makers)

API orders can specify a self-trade prevention mode:

ModeBehavior
noneNo prevention. Same as the web default.
cancel_takerIf the new (incoming) order would match your own resting order, cancel the new one.
cancel_makerIf the new order would match your own resting order, cancel the resting one and let the new one rest.
cancel_bothCancel both orders if they would cross.

See the API reference for order types for the exact request schema.

Negative cases

  • Different accounts — STP only triggers when both orders are on the same account. If you trade from two different addresses, they're separate accounts as far as STP is concerned.
  • Different markets — STP is per-market. A buy on market A and a sell on market B never cross.

Was this article helpful?

Your feedback helps us improve our docs.