Skip to content

Instantly share code, notes, and snippets.

@noelrocha
Last active February 12, 2026 20:36
Show Gist options
  • Select an option

  • Save noelrocha/174da7433319b680d63739be49dcb9ba to your computer and use it in GitHub Desktop.

Select an option

Save noelrocha/174da7433319b680d63739be49dcb9ba to your computer and use it in GitHub Desktop.
Placing TP Order
The problem.
If I create two or more positions without inline TP and then select any open positions except the first on and try to create a TP order, the tp order is always linked with the first open position.
Follow in the comments the step by step to reproduce.
@noelrocha
Copy link
Author

noelrocha commented Feb 10, 2026

To reproduce, simply follow theses steps:

  1. Account configured with HEDGE mode, ISOLATE SEPARATE MARGIN
  2. Open 3 or more orders on the same side and same symbol, type:Market without inline TP using (openApi/swap/v2/trade/order)
  3. Get the list of open positions from /openApi/swap/v2/user/positions
  4. Grab any position (excluding the first of the list).
  5. Try to create a TP order for this position
  6. The TP order is always set to the first position of the user open positions api

@noelrocha
Copy link
Author

Open position list to get the position ID of the second position

Screenshot 2026-02-12 at 12 22 57

@noelrocha
Copy link
Author

Request to create the TP Order on the second open position

Screenshot 2026-02-12 at 12 23 46

@noelrocha
Copy link
Author

Request to get the open orders. You can see that the TP Order is linked to the first open position, a different ID that I passed on the Create tp order on the positionID param

Screenshot 2026-02-12 at 12 26 58

@wardamussa
Copy link

Hello NK,

This is SAJAD from Telegram (@sirjady_y). This is my GitHub account.

When you send the TP request in Step 2, please try setting the TP order explicitly with reduceOnly=true in the request parameters. This will allow us to see how the system responds and what the result will be.

After you have tested it with reduceOnly=true, please document the subsequent screenshots and share them here if it does not work. If it works, just let me know via Telegram. I will know what to do next.

Do not give up you are on the right track. If this does not work, I will escalate the issue to the development team.

@noelrocha
Copy link
Author

Setting the reduceOnly=true, it give the following error. The account is configured as SEPARATE ISOLATED MARGIN and Im forced to use Hedge Mode:

{ "code": 109400, "msg": "In the Hedge mode, the 'ReduceOnly' field can not be filled.", "data": {} }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment