Close Position
Close Position
Close positions for a given product. If posIds is omitted, closes all positions under the product. Consolidates the batch-close-position and close-position-by-ids endpoints.
Request URL
POST /deepcoin/v2/trade/close-position
Request Parameters
| Field Name | Required | Type | Description |
|---|---|---|---|
| instId | true | string | Product ID |
| posIds | false | []string | Position ID list. If omitted, closes all positions under the product |
Request Example
// Close all positions for the product
{
"instId": "ETH-USDT-SWAP"
}
// Close by position IDs
{
"instId": "ETH-USDT-SWAP",
"posIds": ["1001063717138767", "1001063717138768"]
}
Response Parameters
| Field Name | Type | Description |
|---|---|---|
| data | array | Close result list |
data[] item fields:
| Field Name | Type | Description |
|---|---|---|
| instId | string | Product ID |
| posId | string | Position ID |
| posSide | string | Position side |
| memberId | string | Member ID |
| accountId | string | Account ID |
| tradeUnitId | string | Trade unit ID |
| sCode | string | Result code, 0 means success |
| sMsg | string | Result message |
Response Example
{
"data": []
}