Skip to main content

Orders

Create Order

  • POST https://api.poloniex.com/orders

Create an order for an account.

Request ParameterData TypeRequiredDescription
symbolStringtrueThe symbol to trade, like BTC_USDT
sideStringtrueBUY, SELL
timeInForceStringfalseGTC, IOC, FOK (Default: GTC)
typeStringfalseMARKET, LIMIT, LIMIT_MAKER (for placing post only orders). Default type is MARKET.
accountTypeStringfalseSPOT is the default and only supported one.
priceStringfalsePrice is required for non-market orders
quantityStringfalseBase units for the order. Quantity is required for MARKET SELL or any LIMIT orders
amountStringfalseQuote units for the order. Amount is required for MARKET BUY order
clientOrderIdStringfalseMaximum 64-character length.*
allowBorrowBooleanfalseallow order to be placed by borrowing funds (Default: false)
stpModeStringfalseself-trade prevention. Defaults to EXPIRE_TAKER. None: enable self-trade; EXPIRE_TAKER: Taker order will be canceled when self-trade happens
slippageToleranceStringfalseUsed 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 FieldData TypeDescription
idStringorder id
clientOrderIdStringclientOrderId 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 ParameterData TypeRequiredDescription
symbolStringtrueThe symbol to trade, like BTC_USDT
sideStringtrueBUY, SELL
timeInForceStringfalseGTC, IOC, FOK (Default: GTC)
typeStringfalseMARKET, LIMIT, LIMIT_MAKER (for placing post only orders). Default type is MARKET.
accountTypeStringfalseSPOT is the default and only supported one.
priceStringfalsePrice is required for non-market orders
quantityStringfalseBase units for the order. Quantity is required for MARKET SELL or any LIMIT orders
amountStringfalseQuote units for the order. Amount is required for MARKET BUY order
clientOrderIdStringfalseMaximum 64-character length.*
allowBorrowBooleanfalseallow order to be placed by borrowing funds (Default: false)
stpModeStringfalseself-trade prevention. Defaults to EXPIRE_TAKER. None: enable self-trade; EXPIRE_TAKER: Taker order will be canceled when self-trade happens
slippageToleranceStringfalseUsed 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 FieldData TypeDescription
idStringorder id
clientOrderIdStringclientOrderId 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 ParameterData TypeRequiredDescription
clientOrderIdStringfalseclientOrderId of the new order*
priceStringfalseamended price
quantityStringfalseamended quantity
amountStringfalseamended amount (needed for MARKET buy)
typeStringfalseamended type; MARKET, LIMIT, LIMIT_MAKER (for placing post only orders)
timeInForceStringfalseamended timeInForce; GTC, IOC, FOK (Default: GTC)
allowBorrowBooleanfalseallow order to be placed by borrowing funds (Default: false)
proceedOnFailureStringfalseif 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
slippageToleranceStringfalseUsed 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 FieldData TypeDescription
idStringorder id of the new order
clientOrderIdStringclientOrderId 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."
}

Open Orders

  • GET https://api.poloniex.com/orders

Get a list of active orders for an account.

Request ParameterData TypeRequiredDescription
symbolStringfalseThe symbol to trade,like BTC_USDT. Default is for all symbols if not specified.
sideStringfalseBUY, SELL
fromLongfalseit is 'orderId'. The query begin at ‘from', and it is 0 when you first query.
directionStringfalsePRE, NEXT
limitIntegerfalseMax number of records to return. Default is 500. Max value is 2000.
Response FieldData TypeDescription
idStringorder id
clientOrderIdStringuser specified id
symbolStringThe symbol to trade,like BTC_USDT
stateStringorder state: NEW,PARTIALLY_FILLED
accountTypeStringSPOT
sideStringBUY, SELL
typeStringMARKET, LIMIT, LIMIT_MAKER
timeInForceStringGTC, IOC, FOK
quantityStringbase units for the order
priceString
avgPriceStringavgPrice = filledAmount/filledQuantity
amountStringquote units for the order
filledQuantityString
filledAmountString
createTimeLong
updateTimeLong
orderSourceStringsource of the order e.g API, APP, WEB
loanBooleantrue if borrowed funds, false otherwise
Example output:
[
{
"id": "24993088082542592",
"clientOrderId": "",
"symbol": "ELON_USDC",
"state": "NEW",
"accountType": "SPOT",
"side": "SELL",
"type": "MARKET",
"timeInForce": "GTC",
"quantity": "1.00",
"price": "0.00",
"avgPrice": "0.00",
"amount": "0.00",
"filledQuantity": "0.00",
"filledAmount": "0.00",
"createTime": 1646925216548,
"updateTime": 1646925216548,
"orderSource": "API",
"loan": false,
},
{
"id": "21934611974062080",
"clientOrderId": "123",
"symbol": "TRX_USDC",
"state": "NEW",
"accountType": "SPOT",
"side": "SELL",
"type": "LIMIT",
"timeInForce": "GTC",
"quantity": "1.00",
"price": "10.00",
"avgPrice": "0.00",
"amount": "0.00",
"filledQuantity": "0.00",
"filledAmount": "0.00",
"createTime": 1646196019020,
"updateTime": 1646196019020,
"orderSource": "API",
"loan": true
}
]

Order Details

  • GET https://api.poloniex.com/orders/{id}
  • GET https://api.poloniex.com/orders/cid:{clientOrderId}

Get an order’s status. Either by specifying orderId or clientOrderId. If id is a clientOrderId, prefix with cid: e.g. cid:myId-1

Request ParameterData TypeRequiredDescription
idStringtrueEither orderId or clientOrderId (prefix with cid: )
Response FieldData TypeDescription
idStringorder id
clientOrderIdStringuser specified id
symbolStringThe symbol to trade, like BTC_USDT
stateStringNEW, PARTIALLY_FILLED, FILLED, PENDING_CANCEL, PARTIALLY_CANCELED, CANCELED, FAILED
accountTypeStringSPOT
sideStringBUY, SELL
typeStringMARKET, LIMIT, LIMIT_MAKER
timeInForceStringGTC, IOC, FOK
quantityStringbase units for the order
priceString
avgPriceStringavgPrice = filledAmount/filledQuantity
amountStringquote units for the order
filledQuantityString
filledAmountString
createTimeLong
updateTimeLong
orderSourceStringsource of the order e.g API, APP, WEB
loanBooleantrue if borrowed funds, false otherwise
cancelReasonIntegercode specified to provide reason for cancelation if applicable; 0: "Not applicable"; 1: "As requested by user"; 1000-1999: "Due to breach of controls in matching engine; 1004: "Due to self-trade"; 1012: "exceed slippage tolerance"; 2000: "Due to margin liquidation"; 2001: "Due to margin threshold breach"; 2002: "Due to symbol marked as offline"
Example output:
{
"id": "21934611974062080",
"clientOrderId": "123",
"symbol": "TRX_USDC",
"state": "NEW",
"accountType": "SPOT",
"side": "SELL",
"type": "LIMIT",
"timeInForce": "GTC",
"quantity": "1.00",
"price": "10.00",
"avgPrice": "0.00",
"amount": "0.00",
"filledQuantity": "0.00",
"filledAmount": "0.00",
"createTime": 1646196019020,
"updateTime": 1646196019020,
"orderSource": "API",
"loan": false,
"cancelReason": 0,
}

Cancel Order by Id

  • DELETE https://api.poloniex.com/orders/{id}
  • DELETE https://api.poloniex.com/orders/cid:{clientOrderId}

Cancel an active order.

Request ParameterData TypeRequiredDescription
idStringtrueorder's id or its clientOrderId (prefix with cid: )
Response FieldData TypeDescription
orderIdStringthe order id
clientOrderIdStringclientOrderId of the order.
stateStringorder's state (PENDING_CANCEL)
codeIntegerresponse code.
messageStringresponse message.
Example output:
{
"orderId": "32487004629499904",
"clientOrderId": "54321",
"state": "PENDING_CANCEL",
"code": 200,
"message": ""
}

Cancel Multiple Orders by Ids

  • DELETE https://api.poloniex.com/orders/cancelByIds

Batch cancel one or many active orders in an account by IDs.

Request ParameterData TypeRequiredDescription
orderIdsStringNo, except clientOrderIds is null or emptyList of order id
clientOrderIdsStringNo, except orderIds is null or emptyList of clientOrderId
Response FieldData TypeDescription
orderIdStringthe order id
clientOrderIdStringclientOrderId of the order.
stateStringorder's state (PENDING_CANCEL)
codeIntegerresponse code.
messageStringresponse message.
Example request (body is required, parameters could be optional):

Request:

{ 
"orderIds": ["12345", "67890"],
"clientOrderIds": ["33344", "myId-1"]
}

Response:

[
{
"orderId": "12345",
"clientOrderId": "33344",
"state": "PENDING_CANCEL",
"code": 200,
"message":""
},
{
"orderId": "67890",
"clientOrderId": "myId-1",
"state": "PENDING_CANCEL",
"code": 200,
"message":""
}
]

Cancel All Orders

  • DELETE https://api.poloniex.com/orders

Batch cancel all orders in an account.

Request ParameterData TypeRequiredDescription
symbolsString arrayfalseIf symbols are specified then all orders with those symbols will be canceled. If symbols are not specified or array is empty, it will cancel user's all orders for all symbols.
accountTypesString arrayfalseSPOT is the default and only supported one.
Response FieldData TypeDescription
orderIdStringthe order id
clientOrderIdStringclientOrderId of the order.
stateStringorder's state (PENDING_CANCEL)
codeIntegerresponse code.
messageStringresponse message.
Example request (body is required, but parameters are optional; an empty body implies cancelling all orders):

Request:

{
"symbols": ["BTC_USDT", "ETH_USDT"],
"accountTypes": ["SPOT"]
}

Response:

[{
"orderId": "111222333444",
"clientOrderId": "666666",
"state": "PENDING_CANCEL",
"code": 200,
"message": "SUCCESS"
},
{
"orderId": "333444555666",
"clientOrderId": "777777",
"state": "PENDING_CANCEL",
"code": 200,
"message": "SUCCESS"
}]

Kill Switch

  • POST https://api.poloniex.com/orders/killSwitch

Set a timer that cancels all regular and smartorders after the timeout has expired. Timeout can be reset by calling this command again with a new timeout value. A timeout value of -1 disables the timer. Timeout is defined in seconds.

Request ParameterData TypeRequiredDescription
timeoutStringtruetimer value in seconds; range is -1 and 10 to 600
Response FieldData TypeDescription
startTimeLongtime when timer is started (milliseconds since UNIX epoch)
cancellationTimeLongtime when timer is set to expire which will trigger cancellation (milliseconds since UNIX epoch)
Enable kill switch with a timeout of 60 seconds:
{
"timeout": "60"
}

> Example output:

```json
{
"startTime": "1665456130",
"cancellationTime": "1665456190"
}
Disable kill switch:
{
"timeout": "-1"
}

Example output:

{
"startTime": "1665456160",
"cancellationTime": "0"
}

Kill Switch Status

  • GET https://api.poloniex.com/orders/killSwitchStatus

Get status of kill switch. If there is an active kill switch then the start and cancellation time is returned. If no active kill switch then an error message with code is returned

Response FieldData TypeDescription
startTimeLongtime when timer is started (milliseconds since UNIX epoch)
cancellationTimeLongtime when timer is set to expire which will trigger cancellation (milliseconds since UNIX epoch)
No active kill switch example output:

Request:

{
"startTime": "1665456130",
"cancellationTime": "1665456190"
}

Response:

{
"code": 25020,
"message": "No active kill switch"
}