Skip to main content

Overview

Self Match Prevention (SMP) is a mechanism that prevents orders from matching with each other when they originate from the same member AND share the same SMP token. SMP helps prevent accidental self-trading and allows for more granular control over order matching behavior. SMP uses three components to control order matching:
ComponentDescriptionRequiredScope
SMP ModeDetermines which order is cancelled when a self-match is detectedPer order (default configured in Thunder account settings or via private/set_self_trading_config)Order-level
SMP TokenPrevents matching between orders with the same tokenMandatory (can be set to null/0)Order-level
Member IDScopes SMP to a specific memberSMP cannot trigger between MembersMember-level
SMP mode determines which order is cancelled when a self-match is detected:
ModeBehavior
CANCEL_MAKERThe resting (maker) order is cancelled
CANCEL_TAKERThe incoming (taker) order is cancelled
The SMP mode should be specified for each order. A default SMP mode can be configured in Thunder through account settings or via the private/set_self_trading_config method, and users can change their default setting.
SMP Mode Selection: When a self-match is detected, the SMP mode from the aggressing order (the incoming order) will be used to determine which order is cancelled.

Order from different systems

Orders originating from the Websocket API, User Interface or other non-Starbase origin will have the SMP Token set based on the table below. To avoid matching with these orders when utilizing Starbase APIs, the same SMP Tokens should be used.
SettingSMP Token Value
Self-match prevention restricted to subaccountsub-account id (equal to Deribit’s User ID)
Self-match prevention enabled across all subaccountsmain-account id (equal to Deribit’s User ID)
Self-matching allowednull (empty)

API Usage

Order Entry Messages

SMP fields are mandatory and must be specified in the following order entry messages:
MessageSMP Token FieldField NumberDescription
NewOrderRequestSMPToken7This order cannot match with any other orders within the same portfolio with the same token. Set to null to allow self-matching.
MassQuoteRequestSMPToken4This order cannot match with any other orders within the same portfolio with the same token. Set to null to allow self-matching.

SMP Cancellation Indicators

When an order is cancelled due to self-match prevention, it will be indicated in the response messages:
MessageFieldValueDescription
NewOrderResponsecancelReason (field 11)1selfMatchPrevention
AmendOrderResponsecancelReason (field 12)1selfMatchPrevention
MassQuoteResponsebuyQuoteStatus (field 18)7CanceledBySelfMatch
MassQuoteResponsesellQuoteStatus (field 19)7CanceledBySelfMatch