Orders
Create Order
- POST
https://api.poloniex.com/orders
Create an order for an account.
Request Parameter | Data Type | Required | Description |
---|---|---|---|
symbol | String | true | The symbol to trade, like BTC_USDT |
side | String | true | BUY, SELL |
timeInForce | String | false | GTC, IOC, FOK (Default: GTC) |
type | String | false | MARKET, LIMIT, LIMIT_MAKER (for placing post only orders). Default type is MARKET. |
accountType | String | false | SPOT is the default and only supported one. |
price | String | false | Price is required for non-market orders |
quantity | String | false | Base units for the order. Quantity is required for MARKET SELL or any LIMIT orders |
amount | String | false | Quote units for the order. Amount is required for MARKET BUY order |
clientOrderId | String | false | Maximum 64-character length.* |
allowBorrow | Boolean | false | allow order to be placed by borrowing funds (Default: false) |
stpMode | String | false | self-trade prevention. Defaults to EXPIRE_TAKER. None: enable self-trade; EXPIRE_TAKER: Taker order will be canceled when self-trade happens |
slippageTolerance | String | false | Used to control the maximum slippage ratio, the value range is greater than 0 and less than 1 |
*Only the following characters are allowed as part of clientOrderId:[A-Za-z0-9_-] , Unique order id created by users to identify their orders, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-)
Response Field | Data Type | Description |
---|---|---|
id | String | order id |
clientOrderId | String | clientOrderId user specifies in request or an empty string. |
Example request 1 (Limit Buy 100 BTC_USDT at 40,000.50):
Request:
{
"symbol": "BTC_USDT",
"type": "LIMIT",
"quantity": "100",
"side": "BUY",
"price": "40000.50000",
"timeInForce": "IOC",
"clientOrderId": "1234Abc"
}
Response:
{
"id": "29772698821328896",
"clientOrderId": "1234Abc"
}
Example request 2 (Market Buy 100 BTC_USDT):
Request:
{
"symbol": "BTC_USDT",
"amount": "100",
"side": "BUY"
}
Response:
{
"id": "2977269882132774",
"clientOrderId": ""
}
Create Multiple Orders
- POST
https://api.poloniex.com/orders/batch
Create multiple orders via a single request. Max limit of 20 orders. Request parameter is an array of json objects with order details.
Request Parameter | Data Type | Required | Description |
---|---|---|---|
symbol | String | true | The symbol to trade, like BTC_USDT |
side | String | true | BUY, SELL |
timeInForce | String | false | GTC, IOC, FOK (Default: GTC) |
type | String | false | MARKET, LIMIT, LIMIT_MAKER (for placing post only orders). Default type is MARKET. |
accountType | String | false | SPOT is the default and only supported one. |
price | String | false | Price is required for non-market orders |
quantity | String | false | Base units for the order. Quantity is required for MARKET SELL or any LIMIT orders |
amount | String | false | Quote units for the order. Amount is required for MARKET BUY order |
clientOrderId | String | false | Maximum 64-character length.* |
allowBorrow | Boolean | false | allow order to be placed by borrowing funds (Default: false) |
stpMode | String | false | self-trade prevention. Defaults to EXPIRE_TAKER. None: enable self-trade; EXPIRE_TAKER: Taker order will be canceled when self-trade happens |
slippageTolerance | String | false | Used to control the maximum slippage ratio, the value range is greater than 0 and less than 1 |
*Only the following characters are allowed as part of clientOrderId:[A-Za-z0-9_-] , Unique order id created by users to identify their orders, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-)
Array of json objects with results for each order details.
Response Field | Data Type | Description |
---|---|---|
id | String | order id |
clientOrderId | String | clientOrderId user specifies in request or an empty string. |
Example:
Request:
[
{
"symbol": "BTC_USDT",
"amount": "100",
"side": "BUY"
},
{
"symbol": "BTC_USDT",
"type": "LIMIT",
"quantity": "100",
"side": "BUY",
"price": "40000.50000",
"timeInForce": "IOC",
"clientOrderId": "1234Abc"
},
{
"symbol": "ETH_USDT",
"amount": "1000",
"side": "BUY"
},
{
"symbol": "TRX_USDT",
"type": "LIMIT",
"quantity": "15000",
"side": "SELL",
"price": "0.0623423423",
"timeInForce": "IOC",
"clientOrderId": "456Xyz"
}
]
Response:
[
{
"id": "2977269882132774",
"clientOrderId": ""
},
{
"id": "29772698821328896",
"clientOrderId": "1234Abc"
},
{
"code": 21709,
"message": "Low available balance",
"clientOrderId": ""
},
{
"code": 21312,
"message": "Client order id repeat",
"clientOrderId": "456Xyz"
}
]
Cancel Replace Order
- PUT
https://api.poloniex.com/orders/{id}
- PUT
https://api.poloniex.com/orders/cid:{clientOrderId}
Cancel an existing active order, new or partially filled, and place a new order on the same symbol with details from existing order unless amended by new parameters. The replacement order can amend price, quantity, amount, type, timeInForce, and allowBorrow fields. Specify the existing order id in the path; if id is a clientOrderId, prefix with cid: e.g. cid:myId-1. The proceedOnFailure flag is intended to specify whether to continue with new order placement in case cancelation of the existing order fails. Please note that since the new order placement does not wait for funds to clear from the existing order cancelation, it is possible that the new order will fail due to low available balance.
Request Parameter | Data Type | Required | Description |
---|---|---|---|
clientOrderId | String | false | clientOrderId of the new order* |
price | String | false | amended price |
quantity | String | false | amended quantity |
amount | String | false | amended amount (needed for MARKET buy) |
type | String | false | amended type; MARKET, LIMIT, LIMIT_MAKER (for placing post only orders) |
timeInForce | String | false | amended timeInForce; GTC, IOC, FOK (Default: GTC) |
allowBorrow | Boolean | false | allow order to be placed by borrowing funds (Default: false) |
proceedOnFailure | String | false | if set to true then new order will be placed even if cancelation of the existing order fails; if set to false (DEFAULT value) then new order will not be placed if the cancelation of the existing order fails |
slippageTolerance | String | false | Used to control the maximum slippage ratio, the value range is greater than 0 and less than 1 |
*Only the following characters are allowed as part of clientOrderId:[A-Za-z0-9_-] , Unique order id created by users to identify their orders, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-)
Response Field | Data Type | Description |
---|---|---|
id | String | order id of the new order |
clientOrderId | String | clientOrderId of the new order if specified or an empty string |
Example request 1 (cancel and replace an order's price):
Request:
{
"clientOrderId": "1234Abc"
"price": "18000"
}
Response:
{
"id": "29772698821328896",
"clientOrderId": "1234Abc"
}
Example request 2 (cancel and replace an order that is already filled):
Request:
{
"clientOrderId": "1234Abc"
"price": "18000",
"quantity": "20"
}
Response:
{
"code": 21359,
"message": "Order was already canceled or filled."
}