Skip to main content

Smart Orders

Create Order

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

Create a smart order for an account. Funds will only be frozen when the smart order triggers, not upon smart order creation.

Request ParameterData TypeRequiredDescription
symbolStringtrueOnly supported one.
sideStringtrueBUY, SELL
timeInForceStringfalseFOK, IOC, GTC (Default: GTC)
typeStringfalseSTOP, STOP_LIMIT, TRAILING_STOP, TRAILING_STOP_LIMIT (Default: STOP if price not specified or STOP_LIMIT if price is specified)
accountTypestringfalseSPOT is the default and only supported one.
priceStringfalseRequired for STOP_LIMIT
stopPriceStringfalsePrice at which order is triggered for STOP or STOP_LIMIT order; Activation price for TRAING_STOP or TRAING_STOP_LIMIT order
quantityStringtruebase units for the order
amountStringfalsequote units for the order
clientOrderIdStringfalseMaximum 64-character length*
trailingOffsetStringfalsetrailing stop price offset (Suffix with%, to trailing the proportion, without%, to trailing the price distance) Required for type TRAILING_STOP or TRAILING_STOP_LIMIT
limitOffsetStringfalseWhen the order is triggered, the order is issued with a limit order based on the offset of the market price. ( Suffix with%, to limit the proportion, without%, to limit the price distance) Required for TRAILING_STOP_LIMIT
operatorStringfalseActivation the price operator when orderType is TRAILING_STOP or TRAILING_STOP_LIMIT. GTE-greater than and equal (> =). LTE-less than and equal (< =)

*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(-)

Example request:
{
"quantity": "100",
"side": "BUY",
"type": "STOP_LIMIT",
"price": "60100.00"
"stopPrice": "60000.00",
"timeInForce": "FOK",
"clientOrderId": "999999910",
"symbol": "BTC_USDT"
}
Response FieldData TypeDescription
idStringsmart order id
clientOrderIdStringclientOrderId user specifies in request or an empty string.
Example output:
{
"id": "10000009",
"clientOrderId": "999999910"
}

Cancel Replace Order

  • PUT https://api.poloniex.com/smartorders/{id}
  • PUT https://api.poloniex.com/smartorders/cid:{clientOrderId}

Cancel an existing untriggered smart order and place a new smart order on the same symbol with details from existing smart order unless amended by new parameters. The replacement smart order can amend price, stopPrice, quantity, amount, type, and timeInForce fields. Specify the existing smart 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 smart order placement in case cancelation of the existing smart order fails.

Request ParameterData TypeRequiredDescription
clientOrderIdStringfalseclientOrderId of the new order*
priceStringfalseamended price
stopPriceStringfalseamended stop price at which order is triggered
quantityStringfalseamended quantity
amountStringfalseamended amount
typeStringfalseamended type; STOP, STOP_LIMIT
timeInForceStringfalseamended timeInForce; GTC, IOC, FOK (Default: GTC)
proceedOnFailureStringfalseif set to true then new smart order will be placed even if cancelation of the existing smart order fails; if set to false (DEFAULT value) then new smart order will not be placed if the cancelation of the existing smart order fails

*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 smart order
clientOrderIdStringclientOrderId of the new smart order if specified or an empty string
Example request 1 (cancel and replace a smart order's stop price):

Request:

{
"clientOrderId": "1234Abc"
"stopPrice": "18000"
}

Response:

{
"id": "29772698821328896",
"clientOrderId": "1234Abc"
}
Example request 2 (cancel and replace an order that is already triggered):

Request:

{
"clientOrderId": "1234Abc"
"stopPrice": "18000",
"price": "18005",
"quantity": "20"
}

Response:

{
"code": 21301,
"message": "Couldn't locate smart order"
}

Open Orders

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

Get a list of (pending) smart orders for an account.

Request ParameterData TypeRequiredDescription
limitIntegerfalseMax number of records to return. Range: 1 - 2000. Default is 500.
typesstringfalseeg:TRAILING_STOP,TRAILING_STOP_LIMIT,STOP_LIMIT,STOP; Default is STOP_LIMIT,STOP
Response FieldData TypeDescription
idStringsmart order id
clientOrderIdStringuser specified id
symbolStringThe symbol to trade,like BTC_USDT
stateStringorder state: PENDING_NEW
accountTypeStringSPOT
sideStringBUY, SELL
typeStringSTOP, STOP_LIMIT, TRAILING_STOP, TRAILING_STOP_LIMIT
timeInForceStringGTC, IOC, FOK
quantityStringbase units for the order
priceString
amountStringquote units for the order
stopPriceString
createTimeLong
updateTimeLong
trailingOffsetstring
limitOffsetstring
activationPricestringMarket price at the time of actual activation of TRAILING_STOP, TRAILING_STOP_LIMIT order
operatorstringGTE,LTE
Example output:
[
{
"id": "999991586827571200",
"clientOrderId": "",
"symbol": "ETH_USDT",
"state": "PENDING_NEW",
"accountType": "SPOT",
"side": "BUY",
"type": "STOP_LIMIT",
"timeInForce": "GTC",
"quantity": "0.036",
"price": "1",
"amount": "0.00",
"stopPrice": "3750.00",
"createTime": 1630832295888,
"updateTime": 1630832295888
},
{
"id": "999991586827571288",
"clientOrderId": "100832",
"symbol": "BTC_USDT",
"state": "PENDING_NEW",
"accountType": "SPOT",
"side": "SELL",
"type": "STOP_LIMIT",
"timeInForce": "GTC",
"quantity": "0.015",
"price": "11",
"amount": "0.00",
"stopPrice": "55500.00",
"createTime": 1630832298765,
"updateTime": 1630832298765
}
]

Order Details

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

Get a smart order’s status. {id} can be smart order’s id or its clientOrderId (prefix with cid: ). If smart order’s state is TRIGGERED, the response will include the triggered order’s data

Request ParameterData TypeRequiredDescription
idStringtruesmart order's id or its clientOrderId (prefix with cid: )
Response FieldData TypeDescription
idStringsmart order id
clientOrderIdStringuser specified id
symbolStringThe symbol to trade,like BTC_USDT
stateStringorder state: PENDING_NEW, PENDING_CANCEL, CANCELED, TRIGGERED, FAILED
accountTypeStringSPOT
sideStringBUY, SELL
typeStringSTOP, STOP_LIMIT, TRAILING_STOP, TRAILING_STOP_LIMIT
timeInForceStringGTC, IOC, FOK
quantityStringbase units for the order
priceString
amountStringquote units for the order
stopPriceString
createTimeLong
updateTimeLong
triggeredOrderJsonThe triggered order's data. This will only be displayed when the smart order's state is TRIGGERED.
trailingOffsetstring
limitOffsetstring
activationPricestringMarket price at the time of actual activation of TRAILING_STOP, TRAILING_STOP_LIMIT order
operatorstringGTE,LTE

triggeredOrder has same fields as /orders/{id}.

Example output:
[{
"id": "14368195657859072",
"clientOrderId": "18113",
"symbol": "BTC_USDT",
"state": "TRIGGERED",
"accountType": "SPOT",
"side": "BUY",
"type": "STOP",
"timeInForce": "GTC",
"quantity": "0.2",
"price": "41920",
"amount": "10",
"stopPrice": "41946",
"createTime": 1644392044793,
"updateTime": 0,
"triggeredOrder": {
"id": "24106600339865600",
"clientOrderId": "18113",
"symbol": "BTC_USDT",
"state": "PARTIALLY_FILLED",
"accountType": "SPOT",
"side": "BUY",
"type": "MARKET",
"timeInForce": "GTC",
"quantity": "0.00",
"price": "0.00",
"avgPrice": "39991.10",
"amount": "10.00",
"filledQuantity": "0.00025005",
"filledAmount": "9.999774555",
"createTime": 1646713861400,
"updateTime": 1646713861400
}
}]

Cancel Order by Id

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

Cancel a smart order by its id.

Request ParameterData TypeRequiredDescription
idStringtruesmart order's id or its clientOrderId (prefix with cid: )
Response FieldData TypeDescription
orderIdStringthe smart order id
clientOrderIdStringclientOrderId of the smart order.
stateStringsmart order's state (CANCELED)
codeIntegerresponse code.
messageStringresponse message.
Example output:
{
"orderId": "9876543",
"clientOrderId": "88888",
"state": "CANCELED",
"code": 200,
"message":""
}

Cancel Multiple Orders by Id

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

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

Request ParameterData TypeRequiredDescription
orderIdsStringNo, except clientOrderIds is null or emptyList of smart order id, size should be equal to that of clientOrderIds if it is specified
clientOrderIdsStringNo, except orderIds is null or emptyList of clientOrderId, size should be equal to that of orderIds if it is specified
Response FieldData TypeDescription
orderIdStringthe smart order id
clientOrderIdStringclientOrderId of the smart order.
stateStringsmart order's state (CANCELED)
codeIntegerresponse code.
messageStringresponse message.
Example request (body is required, parameters could be optional):

Request:

{ 
"orderIds": ["9876543", "111222333"],
"clientOrderIds": ["88888", "myId-2"]
}

Response:

[
{
"orderId": "9876543",
"clientOrderId": "88888",
"state": "CANCELED",
"code": 200,
"message":""
},
{
"orderId": "111222333",
"clientOrderId": "myId-2",
"state": "CANCELED",
"code": 200,
"message":""
}
]

Cancel All Orders

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

Batch cancel all smart orders in an account

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

Request:

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

Response:

[
{
"orderId": "1111111111",
"clientOrderId": "aaaaa",
"state": "CANCELED",
"code": 200,
"message": "SUCCESS"
},
{
"orderId": "222222222",
"clientOrderId": "",
"state": "CANCELED",
"code": 200,
"message": "SUCCESS"
}
]