Skip to content

Instantly share code, notes, and snippets.

@wardamussa
Last active March 3, 2026 11:52
Show Gist options
  • Select an option

  • Save wardamussa/f24281d96432fa0970679156b573f5a7 to your computer and use it in GitHub Desktop.

Select an option

Save wardamussa/f24281d96432fa0970679156b573f5a7 to your computer and use it in GitHub Desktop.
One of the challenges my client, Sergey, is currently facing is…
According to the official /swap/v2/trade/order documentation, takeProfit and stopLoss are valid optional parameters for TRIGGER_MARKET orders. My requests include these correctly formatted JSON strings, and the initial NEW status response confirms they are received.
However, we are observing critical data persistence issues:
1. SL/TP Stripping
The takeProfit and stopLoss data disappears (returns 0) once the order transitions from NEW to FILLED.
2. Trigger Linkage Failure
The triggerOrderId returns 0 for positions successfully opened via a trigger, breaking the audit trail between the trigger and the resulting execution.
3. Ghost Orders in UI
When manually adding a new SL, the UI shows multiple active SL orders for the same position, creating significant risk management confusion.
Evidence & Logs
Full JSON request/response logs: https://gist.github.com/wardamussa/a10225fa91ee238070a35bedd7d0713a
Specific Examples from Logs
Order ID 2024552179788509184: Initially had SL/TP set. After filling, the new order ID 2024552787808038913 shows takeProfit: {stopPrice: 0}.
Order ID 2027456314699509760: Filled with triggerOrderId: 0, despite being TRIGGER_MARKET type.
Questions
Why do stopLoss and takeProfit objects return 0 in the Query Order response after a TRIGGER_MARKET order is filled?
Why is triggerOrderId returning 0 for a position that was clearly opened by a trigger?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment