How to Configure STP
Option 1 — Global setting:
Log in and go to the Perp trading page
Click the Settings icon in the top-right corner

Under the "Trading" section, find Self-Trade Prevention and click to open

Select your preferred strategy in the pop-up and click Confirm
Changes take effect immediately after saving. Portions already filled are not affected — the selected STP strategy applies only to the remaining unfilled quantity.

Option 2 — API STP Strategy:
Add the
stpModeparameter to thePOST /fapi/v3/orderendpointAPI-level settings take priority over the global setting, but only apply to that specific order
Specifying STP Strategy via API
Use the optional parameter stpMode in POST /fapi/v3/order to set a strategy for an individual order:
stpMode: "EXPIRE_MAKER" // Cancel Maker Only stpMode: "EXPIRE_TAKER" // Cancel Taker Only stpMode: "EXPIRE_BOTH" // Cancel Both
If omitted, the account's global STP setting (
EXPIRE_MAKER) is used automaticallyAPI-specified strategies take priority over the global setting, and apply to that order only
Example: Cancel Maker Only in Action
A user runs two strategies simultaneously on the BTCUSDT perpetual contract, with STP set to Cancel Maker Only.
Strategy A places a limit sell order on the order book: sell 0.1 BTC at 69,000 USDT (maker)
Strategy B then places a market buy order: buy 0.1 BTC at market — the best available ask happens to be 69,000 USDT (Strategy A's order)
The matching engine detects that both orders belong to the same account and triggers STP:
Maker sell order (69,000 limit) → Immediately cancelled, status: EXPIRE Taker buy order (market) → Continues execution, matches against the next ask on the book
The taker order ultimately fills at 69,001 USDT or higher against another seller, and the strategy continues running as intended.
Last updated
