Close Position
POST🔒 Trading
Closes a position at market or limit price.
Note: When using
positionMode: HEDGEorISOLATED, thepositionIdparameter is required.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | String | Yes | Market symbol |
| type | String | Yes | Close type — LIMIT requires price |
| price | Double | No | Close price. Required for LIMIT type |
| postOnly | Boolean | No | Post-only order |
| positionId | String | No | Required when positionMode is HEDGE or ISOLATED |
Response Content
| Name | Type | Description |
|---|---|---|
| symbol | String | Market symbol |
| orderID | String | Order ID |
| clOrderID | String | Custom order ID |
| orderType | Integer | 76: Limit · 77: Market · 80: Algo |
| side | String | Trade side |
| price | Double | Order price |
| status | Integer | Order status code: 2 (ORDER_INSERTED) · 4 (FULLY_MATCHED) · 5 (PARTIAL_FILL) · 6 (CANCELLED) · 9 (TRIGGER_INSERTED) · 10 (TRIGGER_ACTIVATED) · 15 (REJECTED) |
| time_in_force | String | Time in force: GTC · IOC · FOK · HALFMIN · FIVEMIN · HOUR · TWELVEHOUR · DAY · WEEK · MONTH |
| timestamp | Long | Order timestamp |
| trigger | Boolean | Whether order is a trigger order |
| triggerPrice | Double | Trigger price (0 if not a trigger order) |
| avgFilledPrice | Double | Average filled price |
| message | String | Trade message |
| stealth | Double | Algo orders only |
| deviation | Double | Algo orders only |
| remainingSize | Integer | Current order size minus filled size |
| originalOrderSize | Integer | Original quantity — unchanged after amendments |
| currentOrderSize | Integer | Latest quantity (filled + remaining) |
| filledSize | Integer | Quantity filled in this update |
| totalFilledSize | Integer | Cumulative filled quantity |
| postOnly | Boolean | Whether order is post-only |
| positionMode | String | ONE_WAY · HEDGE · ISOLATED |
| positionDirection | String | Position direction: LONG · SHORT (only present in HEDGE/ISOLATED mode) |
| positionId | String | Position ID |
example
POST
https://api.zmo.com/futures/api/v2.3/order/close_position