Introduction to Self-Trade Prevention (STP)lg...
<div><h2><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">1. What is self-trade prevention (STP)?</strong></span></h2><div><br /></div><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">Self-Trade Prevention (STP) is a trading mechanism designed to prevent buy and sell orders from the same user (or different accounts belonging to the same entity) from unintentionally matching with each other in the trading system. The STP mechanism is especially important for maintaining a fair and transparent trading environment, helping to prevent market price manipulation and ensuring that trading activity accurately reflects genuine market interest.</span></span></div><div><br /></div><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">MEXC's Self-Trade Prevention (STP) mechanism is used to prevent orders from the same user or users within the same "tradeGroupId" from matching with each other.</span></span></div><div><br /></div><h2><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">2. What is self-trading?</strong></span></h2><div><br /></div><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">Possible situations where self-trading can occur:</span></span></div><div style="text-align:left"><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">1) Trades between orders from the same account.</span></span></div><div style="text-align:left"><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">2) Trades between different sub-accounts under the same main account.</span></span></div><div><br /></div><h2><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">3. What happens when STP is triggered?</strong></span></h2><div><br /></div><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">When an order triggers the self-trade prevention mechanism, the system may apply one of the following four modes:</span></span></div><div><br /></div><div style="text-align:left"><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">1) NONE Mode: </strong>The order is not affected by the STP mechanism. The system does not check the account or tradeGroupId, and the trade executes normally.</span></span></div><div><br /></div><div style="text-align:left"><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">2) CANCEL_TAKER Mode: </strong>The remaining quantity of the taker order is immediately canceled to prevent the trade from executing.</span></span></div><div><br /></div><div style="text-align:left"><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">3) CANCEL_MAKER Mode: </strong>The remaining quantity of the maker order is immediately canceled to prevent the trade from executing.</span></span></div><div><br /></div><div style="text-align:left"><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">4) CANCEL_BOTH Mode: </strong>The remaining quantities of both the taker and maker orders are simultaneously canceled to prevent the trade from executing.</span></span></div><div><br /></div><h2><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">4. How to set the STP Mode for an order</strong></span></h2><div><br /></div><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">STP mode can be set using the stpMode parameter in the following API calls:</span></span></div><ul start="1" style="list-style-type:disc"><li style="text-align:left"><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">POST /api/v3/order</span></span></div></li><li style="text-align:left"><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">POST /api/v3/batchOrders</span></span></div></li></ul><div><br /></div><h2><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">5. What is "tradeGroupId"?</strong></span></h2><div><br /></div><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">Accounts sharing the same tradeGroupId are treated as belonging to the same trading group. Orders submitted by members of the same trading group may trigger STP depending on the taker order's STP mode.</span></span></div><div><br /></div><h2><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">6. Which trading pairs support STP?</strong></span></h2><div><br /></div><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">All trading pairs.</span></span></div><div><br /></div><h2><span style="font-family:'arial' , 'helvetica' , sans-serif"><strong style="font-weight:bolder">7. Which order types Support STP?</strong></span></h2><div><br /></div><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">Only the following order types support STP:</span></span></div><ul start="1" style="list-style-type:disc"><li style="text-align:left"><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">LIMIT orders</span></span></div></li><li style="text-align:left"><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">MARKET orders</span></span></div></li><li style="text-align:left"><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">LIMIT_MAKER (post-only) orders</span></span></div></li><li style="text-align:left"><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">IMMEDIATE_OR_CANCEL (IOC) orders</span></span></div></li></ul><div><span style="font-size:16px"><span style="font-family:'arial' , 'helvetica' , sans-serif">Note: STP is not effective when the type is set to FOK (Fill-Or-Kill).</span></span></div><div><br /></div></div>lg...