Skip to main content

Merge Positions

Merge Positions

Merge multiple split positions of the same product and same direction that meet the merge conditions.

Callers only need to provide the product ID and the list of position IDs to merge. The system will automatically identify the position direction, margin mode, and product group based on position information.

Request URL

POST /deepcoin/trade/merge-positions

Request Parameters

Field NameRequiredTypeDescription
instIdtruestringProduct ID, e.g. BTC-USDT-SWAP
posIdstrue[]stringList of position IDs to merge, at least 2, at most 10

Request Example

{
"instId": "BTC-USDT-SWAP",
"posIds": [
"1000587858872759",
"1000587858872760"
]
}

Response Parameters

Field NameTypeDescription
posIdstringPosition ID after merge. Returns empty string if the merged position ID cannot be returned immediately
mergedPosIds[]stringPosition IDs that participated in this merge
instIdstringProduct ID

Response Example

{
"code": "0",
"msg": "",
"data": {
"posId": "1000587858872759",
"mergedPosIds": [
"1000587858872759",
"1000587858872760"
],
"instId": "BTC-USDT-SWAP"
}
}

If the merge is accepted but the merged position ID cannot be returned immediately:

{
"code": "0",
"msg": "",
"data": {
"posId": "",
"mergedPosIds": [
"1000587858872759",
"1000587858872760"
],
"instId": "BTC-USDT-SWAP"
}
}

Notes

Description

  • Merge multiple specified split positions
  • Only supports merging positions of the same product and same direction
  • Position IDs must come from the posId returned by Get Positions API
  • After a successful merge, the latest position can be queried via Get Positions

Precautions

  • posIds must contain at least 2 position IDs and at most 10 position IDs
  • Duplicate position IDs are not allowed in posIds
  • All positions must belong to the account associated with the current API Key
  • All position product IDs must match the instId in the request
  • All positions must be in the same direction, e.g., all long or all short
  • All positions must be split positions, i.e. mrgPosition=split
  • Restricted positions such as copy trading, being copied, and Webhook positions cannot be merged
  • Positions cannot be merged when there are pending orders such as close orders, stop-loss/take-profit orders, increase orders, or trailing stop orders