> For the complete documentation index, see [llms.txt](https://www.pionex.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pionex.com/docs/api-docs/trade-api/trade.md).

# Trade

Order management (private)

## Get order

> Get order details by order ID. Weight: 1.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"Order":{"type":"object","properties":{"orderId":{"type":"integer","format":"int64","description":"Order ID"},"symbol":{"type":"string","description":"Trading pair symbol"},"type":{"type":"string","enum":["LIMIT","MARKET"],"description":"Order type"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Order direction"},"price":{"type":"string","description":"Order price"},"size":{"type":"string","description":"Order quantity"},"amount":{"type":"string","description":"Market buy order amount"},"filledSize":{"type":"string","description":"Filled quantity"},"filledAmount":{"type":"string","description":"Filled amount"},"fee":{"type":"string","description":"Transaction fee"},"feeCoin":{"type":"string","description":"Fee currency"},"status":{"type":"string","enum":["OPEN","CLOSED"],"description":"Order status"},"IOC":{"type":"boolean","description":"Immediate-or-cancel flag"},"clientOrderId":{"type":"string","description":"Client order ID"},"source":{"type":"string","enum":["MANUAL","API"],"description":"Order source"},"createTime":{"type":"integer","format":"int64","description":"Create timestamp in milliseconds"},"updateTime":{"type":"integer","format":"int64","description":"Update timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/order":{"get":{"tags":["Trade"],"summary":"Get order","description":"Get order details by order ID. Weight: 1.","operationId":"getOrder","parameters":[{"$ref":"#/components/parameters/Timestamp"},{"name":"orderId","in":"query","required":true,"description":"Order ID","schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/BaseResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Order"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## New order

> Place a new order. Weight: 1.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"NewOrderRequest":{"type":"object","required":["symbol","side","type"],"properties":{"symbol":{"type":"string","description":"Trading pair symbol"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Order direction"},"type":{"type":"string","enum":["LIMIT","MARKET"],"description":"Order type"},"clientOrderId":{"type":"string","description":"Client order ID (alphanumeric and hyphen, max 64 characters)","maxLength":64,"pattern":"^[a-zA-Z0-9-]+$"},"size":{"type":"string","description":"Order quantity (required for LIMIT orders and MARKET sell orders)"},"price":{"type":"string","description":"Order price (required for LIMIT orders)"},"amount":{"type":"string","description":"Order amount (required for MARKET buy orders)"},"IOC":{"type":"boolean","description":"Immediate-or-cancel flag","default":false}}},"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/order":{"post":{"tags":["Trade"],"summary":"New order","description":"Place a new order. Weight: 1.","operationId":"newOrder","parameters":[{"$ref":"#/components/parameters/Timestamp"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewOrderRequest"}}}},"responses":{"200":{"description":"Order placed successfully","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/BaseResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"orderId":{"type":"integer","format":"int64","description":"Unique order identifier"},"clientOrderId":{"type":"string","description":"Client-provided order identifier"}}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## Cancel order

> Cancel an existing order. Weight: 1.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/order":{"delete":{"tags":["Trade"],"summary":"Cancel order","description":"Cancel an existing order. Weight: 1.","operationId":"cancelOrder","parameters":[{"$ref":"#/components/parameters/Timestamp"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["symbol","orderId"],"properties":{"symbol":{"type":"string","description":"Trading pair symbol"},"orderId":{"type":"integer","format":"int64","description":"Order ID to cancel"}}}}}},"responses":{"200":{"description":"Order cancelled successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## New multiple orders

> Place multiple orders at once (up to 20, LIMIT only). Weight: 1.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"MassOrderRequest":{"type":"object","required":["symbol","orders"],"properties":{"symbol":{"type":"string","description":"Trading pair symbol"},"orders":{"type":"array","description":"Collection of orders (up to 20)","maxItems":20,"items":{"type":"object","required":["side","type","size","price"],"properties":{"side":{"type":"string","enum":["BUY","SELL"]},"type":{"type":"string","enum":["LIMIT"],"description":"Only LIMIT orders are supported"},"clientOrderId":{"type":"string","description":"Client order ID (alphanumeric and hyphen, max 64 characters)","maxLength":64},"size":{"type":"string","description":"Order quantity"},"price":{"type":"string","description":"Order price"}}}}}},"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/massOrder":{"post":{"tags":["Trade"],"summary":"New multiple orders","description":"Place multiple orders at once (up to 20, LIMIT only). Weight: 1.","operationId":"newMassOrder","parameters":[{"$ref":"#/components/parameters/Timestamp"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MassOrderRequest"}}}},"responses":{"200":{"description":"Orders placed successfully","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/BaseResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"orderIds":{"type":"array","items":{"type":"object","properties":{"orderId":{"type":"integer","format":"int64"},"clientOrderId":{"type":"string"}}}}}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## Get order by client order ID

> Get order details by client order ID. Weight: 1.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"Order":{"type":"object","properties":{"orderId":{"type":"integer","format":"int64","description":"Order ID"},"symbol":{"type":"string","description":"Trading pair symbol"},"type":{"type":"string","enum":["LIMIT","MARKET"],"description":"Order type"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Order direction"},"price":{"type":"string","description":"Order price"},"size":{"type":"string","description":"Order quantity"},"amount":{"type":"string","description":"Market buy order amount"},"filledSize":{"type":"string","description":"Filled quantity"},"filledAmount":{"type":"string","description":"Filled amount"},"fee":{"type":"string","description":"Transaction fee"},"feeCoin":{"type":"string","description":"Fee currency"},"status":{"type":"string","enum":["OPEN","CLOSED"],"description":"Order status"},"IOC":{"type":"boolean","description":"Immediate-or-cancel flag"},"clientOrderId":{"type":"string","description":"Client order ID"},"source":{"type":"string","enum":["MANUAL","API"],"description":"Order source"},"createTime":{"type":"integer","format":"int64","description":"Create timestamp in milliseconds"},"updateTime":{"type":"integer","format":"int64","description":"Update timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/orderByClientOrderId":{"get":{"tags":["Trade"],"summary":"Get order by client order ID","description":"Get order details by client order ID. Weight: 1.","operationId":"getOrderByClientOrderId","parameters":[{"$ref":"#/components/parameters/Timestamp"},{"name":"clientOrderId","in":"query","required":true,"description":"Client order ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/BaseResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Order"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## Get open orders

> Get all open orders for a symbol. Maximum 200 open orders per symbol. Weight: 5.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"Order":{"type":"object","properties":{"orderId":{"type":"integer","format":"int64","description":"Order ID"},"symbol":{"type":"string","description":"Trading pair symbol"},"type":{"type":"string","enum":["LIMIT","MARKET"],"description":"Order type"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Order direction"},"price":{"type":"string","description":"Order price"},"size":{"type":"string","description":"Order quantity"},"amount":{"type":"string","description":"Market buy order amount"},"filledSize":{"type":"string","description":"Filled quantity"},"filledAmount":{"type":"string","description":"Filled amount"},"fee":{"type":"string","description":"Transaction fee"},"feeCoin":{"type":"string","description":"Fee currency"},"status":{"type":"string","enum":["OPEN","CLOSED"],"description":"Order status"},"IOC":{"type":"boolean","description":"Immediate-or-cancel flag"},"clientOrderId":{"type":"string","description":"Client order ID"},"source":{"type":"string","enum":["MANUAL","API"],"description":"Order source"},"createTime":{"type":"integer","format":"int64","description":"Create timestamp in milliseconds"},"updateTime":{"type":"integer","format":"int64","description":"Update timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/openOrders":{"get":{"tags":["Trade"],"summary":"Get open orders","description":"Get all open orders for a symbol. Maximum 200 open orders per symbol. Weight: 5.","operationId":"getOpenOrders","parameters":[{"$ref":"#/components/parameters/Timestamp"},{"name":"symbol","in":"query","required":true,"description":"Trading pair symbol","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/BaseResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}}}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## Get all orders

> Get all orders (open and closed) for a symbol. Weight: 5.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"Order":{"type":"object","properties":{"orderId":{"type":"integer","format":"int64","description":"Order ID"},"symbol":{"type":"string","description":"Trading pair symbol"},"type":{"type":"string","enum":["LIMIT","MARKET"],"description":"Order type"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Order direction"},"price":{"type":"string","description":"Order price"},"size":{"type":"string","description":"Order quantity"},"amount":{"type":"string","description":"Market buy order amount"},"filledSize":{"type":"string","description":"Filled quantity"},"filledAmount":{"type":"string","description":"Filled amount"},"fee":{"type":"string","description":"Transaction fee"},"feeCoin":{"type":"string","description":"Fee currency"},"status":{"type":"string","enum":["OPEN","CLOSED"],"description":"Order status"},"IOC":{"type":"boolean","description":"Immediate-or-cancel flag"},"clientOrderId":{"type":"string","description":"Client order ID"},"source":{"type":"string","enum":["MANUAL","API"],"description":"Order source"},"createTime":{"type":"integer","format":"int64","description":"Create timestamp in milliseconds"},"updateTime":{"type":"integer","format":"int64","description":"Update timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/allOrders":{"get":{"tags":["Trade"],"summary":"Get all orders","description":"Get all orders (open and closed) for a symbol. Weight: 5.","operationId":"getAllOrders","parameters":[{"$ref":"#/components/parameters/Timestamp"},{"name":"symbol","in":"query","required":true,"description":"Trading pair symbol","schema":{"type":"string"}},{"name":"startTime","in":"query","description":"Start time in milliseconds","schema":{"type":"integer","format":"int64"}},{"name":"endTime","in":"query","description":"End time in milliseconds","schema":{"type":"integer","format":"int64"}},{"name":"limit","in":"query","description":"Default: 50. Range: 1 - 200. Returns latest orders when exceeding limit.","schema":{"type":"integer","default":50,"minimum":1,"maximum":200}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/BaseResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}}}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## Cancel all orders

> Cancel all open orders for a symbol. Weight: 1.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/allOrders":{"delete":{"tags":["Trade"],"summary":"Cancel all orders","description":"Cancel all open orders for a symbol. Weight: 1.","operationId":"cancelAllOrders","parameters":[{"$ref":"#/components/parameters/Timestamp"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["symbol"],"properties":{"symbol":{"type":"string","description":"Trading pair symbol"}}}}}},"responses":{"200":{"description":"All orders cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## Get fills

> Get trade fills for a symbol. Returns latest 100 fills when exceeding limit. Weight: 5.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"Fill":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Fill ID"},"orderId":{"type":"integer","format":"int64","description":"Order ID"},"symbol":{"type":"string","description":"Trading pair symbol"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Trade direction"},"role":{"type":"string","enum":["TAKER","MAKER"],"description":"Participant role"},"price":{"type":"string","description":"Fill price"},"size":{"type":"string","description":"Fill quantity"},"fee":{"type":"string","description":"Transaction fee"},"feeCoin":{"type":"string","description":"Fee currency"},"timestamp":{"type":"integer","format":"int64","description":"Fill timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/fills":{"get":{"tags":["Trade"],"summary":"Get fills","description":"Get trade fills for a symbol. Returns latest 100 fills when exceeding limit. Weight: 5.","operationId":"getFills","parameters":[{"$ref":"#/components/parameters/Timestamp"},{"name":"symbol","in":"query","required":true,"description":"Trading pair symbol","schema":{"type":"string"}},{"name":"startTime","in":"query","description":"Start time in milliseconds","schema":{"type":"integer","format":"int64"}},{"name":"endTime","in":"query","description":"End time in milliseconds","schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/BaseResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"fills":{"type":"array","description":"Fills sorted by time descending","items":{"$ref":"#/components/schemas/Fill"}}}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## Get fills by order ID

> Get trade fills for a specific order. Weight: 5.

```json
{"openapi":"3.0.3","info":{"title":"Pionex Open API","version":"1.0.0"},"tags":[{"name":"Trade","description":"Order management (private)"}],"servers":[{"url":"https://api.pionex.com","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"PIONEX-KEY","description":"API Key authentication. Requires two headers:\n- `PIONEX-KEY`: Your API Key\n- `PIONEX-SIGNATURE`: HMAC SHA256 hex signature\n\nAnd a `timestamp` query parameter (milliseconds).\n"}},"parameters":{"Timestamp":{"name":"timestamp","in":"query","required":true,"description":"Current timestamp in milliseconds (valid range +/- 20 seconds)","schema":{"type":"integer","format":"int64"}}},"schemas":{"BaseResponse":{"type":"object","properties":{"result":{"type":"boolean","description":"Request success indicator"},"timestamp":{"type":"integer","format":"int64","description":"Response timestamp in milliseconds"}}},"Fill":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Fill ID"},"orderId":{"type":"integer","format":"int64","description":"Order ID"},"symbol":{"type":"string","description":"Trading pair symbol"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Trade direction"},"role":{"type":"string","enum":["TAKER","MAKER"],"description":"Participant role"},"price":{"type":"string","description":"Fill price"},"size":{"type":"string","description":"Fill quantity"},"fee":{"type":"string","description":"Transaction fee"},"feeCoin":{"type":"string","description":"Fee currency"},"timestamp":{"type":"integer","format":"int64","description":"Fill timestamp in milliseconds"}}},"ErrorResponse":{"type":"object","properties":{"result":{"type":"boolean"},"code":{"type":"string","description":"Error code","enum":["APIKEY_LOST","SIGNATURE_LOST","IP_NOT_WHITELISTED","INVALID_APIKEY","INVALID_SIGNATURE","APIKEY_EXPIRED","INVALID_TIMESTAMP","PERMISSION_DENIED","TRADE_INVALID_SYMBOL","TRADE_PARAMETER_ERROR","TRADE_OPERATION_DENIED","TRADE_ORDER_NOT_FOUND","MARKET_INVALID_SYMBOL","MARKET_PARAMETER_ERROR","MARKET_INVALID_TIME"]},"message":{"type":"string","description":"Human-readable error message"},"timestamp":{"type":"integer","format":"int64"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/v1/trade/fillsByOrderId":{"get":{"tags":["Trade"],"summary":"Get fills by order ID","description":"Get trade fills for a specific order. Weight: 5.","operationId":"getFillsByOrderId","parameters":[{"$ref":"#/components/parameters/Timestamp"},{"name":"orderId","in":"query","required":true,"description":"Order ID. Returns empty list if not found.","schema":{"type":"integer","format":"int64"}},{"name":"fromId","in":"query","description":"Return 100 earlier fills before this fill ID. Returns latest fills if unspecified.","schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/BaseResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"fills":{"type":"array","description":"Fills sorted by time descending","items":{"$ref":"#/components/schemas/Fill"}}}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```
