Skip to main content

Place algo order

Places an algorithmic spot order (TWAP, PEG, OCO, TRAILING, or CONDITIONAL) on the given trading pair.

Headers

NameTypeRequiredDescription
BROKER-IDStringNoOptional broker/partner identifier to tag orders placed through them

Request Body

Conditional

NameTypeRequiredDescription
orderTypeStringYesCONDITIONAL — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING
symbolStringYesTrading pair, e.g. BTC-USDT
orderSideStringYesBUY or SELL
triggerPriceDoubleYesPrice that activates the order
triggerOrderTypeStringYesTrigger behavior: STOP_LOSS, TAKE_PROFIT, STOP_LOSS_LIMIT, or TAKE_PROFIT_LIMIT
triggerPriceTypeStringYesReference price for the trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE)
clOrderIdStringNoClient-supplied order identifier, echoed in the response (max 64 characters)
orderSizeDoubleNoOrder quantity in base currency; required for SELL market and for the STOP_LOSS_LIMIT / TAKE_PROFIT_LIMIT variants
quoteOrderSizeDoubleNoonly for market order in BUY side
orderPriceDoubleNoonly for limit order
timeInForceStringNoTime-in-force policy for the limit variants (GTC, IOC, FOK)
postOnlyBooleanNoIf true, reject the limit variant if it would immediately match (post-only / maker-only)

Oco

NameTypeRequiredDescription
orderTypeStringYesOCO — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING
symbolStringYesTrading pair, e.g. BTC-USDT
orderSideStringYesBUY or SELL
orderSizeDoubleYesOrder quantity in base currency
takeProfitOrderPriceDoubleYesLimit price of the take-profit leg
stopLossOrderPriceDoubleYesLimit price used once the stop-loss trigger fires
stopLossTriggerPriceDoubleYesPrice that activates the stop-loss leg
stopLossTriggerPriceTypeStringYesReference price for the stop-loss trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE)
clOrderIdStringNoClient-supplied order identifier, echoed in the response (max 64 characters)
timeInForceStringNoTime-in-force policy for the take-profit leg (GTC, IOC, FOK)
postOnlyBooleanNoIf true, reject the take-profit leg if it would immediately match (post-only / maker-only)

Peg

NameTypeRequiredDescription
orderTypeStringYesPEG — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING
symbolStringYesTrading pair, e.g. BTC-USDT
orderSideStringYesBUY or SELL
orderPriceDoubleYesBase price the order is pegged to
orderSizeDoubleYesOrder quantity in base currency
clOrderIdStringNoClient-supplied order identifier, echoed in the response (max 64 characters)
stealthDoubleYesbetween 1 and 100
deviationDoubleNobetween -10 and 10, defaults to 0

Trailing

NameTypeRequiredDescription
orderTypeStringYesTRAILING — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING
symbolStringYesTrading pair, e.g. BTC-USDT
orderSideStringYesBUY or SELL
trailValueDoubleYesDistance the trigger price trails the extreme price; must be positive
trailValueTypeStringYesWhether trailValue is an absolute distance (DISTANCE) or a percentage (PERCENTAGE)
triggerPriceTypeStringNoReference price used to update the trailing trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE)
clOrderIdStringNoClient-supplied order identifier, echoed in the response (max 64 characters)
orderSizeDoubleNoOrder quantity in base currency; only for SELL side
quoteOrderSizeDoubleNoOrder amount in quote currency; only for BUY side
activationTriggerPriceDoubleNoOnly arm the trailing stop after the market price reaches this level
activationTriggerPriceTypeStringNoReference price for the activation trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE)

Twap

NameTypeRequiredDescription
orderTypeStringYesTWAP — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING
symbolStringYesTrading pair, e.g. BTC-USDT
orderSideStringYesBUY or SELL
orderSizeDoubleYesTotal order quantity in base currency
timePeriodLongYesTotal execution window in seconds
clOrderIdStringNoClient-supplied order identifier, echoed in the response (max 64 characters)
makerFirstBooleanNoIf true, place child orders as post-only first before falling back to taker
randomizeSizeBooleanNoIf true, randomize child order sizes to reduce predictability
subTwapMaxOrderSizeDoubleNoMaximum size of each child order, in base currency
maxSpreadDoubleNoPause execution while the bid-ask spread exceeds this value
maxDistanceThroughBookDoubleNo0 to 1; omit or set negative to disable, defaults to -1 (disabled)
pausePriceDoubleNoPause execution when the reference price crosses this level
activationTriggerPriceDoubleNoDelay execution until the market price reaches this level
activationTriggerPriceTypeStringNoReference price for the activation trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE)

Response Content

NameTypeDescription
orderIdStringServer-assigned order identifier
clOrderIdStringEcho of the client-supplied order identifier if one was provided
statusIntegerNumeric status code reflecting the current state of the order (e.g. filled, cancelled, rejected)
marketStringTrading pair, e.g. BTC-USDT
typeIntegerNumeric code identifying the order type (e.g. LIMIT, MARKET, TWAP, PEG)
orderSideStringBUY or SELL
orderPriceDoubleOrder price
postOnlyBooleanWhether the order was submitted as post-only
timestampLongServer-side event timestamp in epoch milliseconds
orderDetailTypeStringDetailed order sub-type when applicable (e.g. TWAP for algo TWAP orders)
messageStringOptional diagnostic message; present only when one is returned (e.g. rejection reason)
userQuoteCurrencyStringQuote currency configured for the user
orderCurrencyString'quote' or 'base'; indicates whether the quote-size or base-size fields below are populated
originalOrderBaseSizeDoubleOriginal size in base currency; populated when orderCurrency is 'base'
originalOrderQuoteSizeDoubleOriginal size in quote currency; populated when orderCurrency is 'quote'
currentOrderBaseSizeDoubleCurrently active size in base currency; populated when orderCurrency is 'base'
currentOrderQuoteSizeDoubleCurrently active size in quote currency; populated when orderCurrency is 'quote'
remainingOrderBaseSizeDoubleRemaining unfilled size in base currency; populated when orderCurrency is 'base'
remainingOrderQuoteSizeDoubleRemaining unfilled size in quote currency; populated when orderCurrency is 'quote'
filledBaseSizeDoubleSize filled by the most recent match, in base currency
totalFilledBaseSizeDoubleCumulative filled size across all matches, in base currency
avgFilledPriceDoubleVolume-weighted average fill price
time_in_forceStringTime-in-force policy (GTC, IOC, FOK); null when not applicable to the order type
example
POSThttps://api.btse.com/spot/api/v4/trade/orders/algo

Request (Oco)

{
"symbol": "BTC-USD",
"orderType": "OCO",
"orderSide": "SELL",
"orderSize": 0.00001,
"takeProfitOrderPrice": 67447.7,
"stopLossOrderPrice": 61024.1,
"stopLossTriggerPrice": 61024.1,
"stopLossTriggerPriceType": "MARK_PRICE"
}

Request (Trailing)

{
"symbol": "BTC-USD",
"orderType": "TRAILING",
"orderSide": "SELL",
"orderSize": 0.00001,
"trailValue": 3211.7,
"trailValueType": "DISTANCE",
"triggerPriceType": "LAST_PRICE",
"activationTriggerPrice": 67447.7,
"activationTriggerPriceType": "LAST_PRICE"
}

Request (Conditional)

{
"symbol": "BTC-USD",
"orderType": "CONDITIONAL",
"orderSide": "SELL",
"orderSize": 0.00001,
"triggerPrice": 67447.7,
"triggerOrderType": "TAKE_PROFIT",
"triggerPriceType": "LAST_PRICE"
}

Request (Peg)

{
"symbol": "BTC-USD",
"orderType": "PEG",
"orderSide": "BUY",
"orderPrice": 61024.1,
"orderSize": 0.00001,
"stealth": 50
}

Request (Twap)

{
"symbol": "BTC-USD",
"orderType": "TWAP",
"orderSide": "BUY",
"orderSize": 0.1,
"timePeriod": 3600
}

Response (Oco)

[
{
"orderId": "1d3b52ca-3dd0-45ed-8819-141e7f2c2cc5",
"clOrderId": "",
"status": 2,
"market": "BTC-USD",
"type": 76,
"orderSide": "SELL",
"orderPrice": 67447.7,
"postOnly": false,
"timestamp": 1784891308363,
"orderDetailType": null,
"message": null,
"userQuoteCurrency": "USD",
"orderCurrency": "base",
"originalOrderBaseSize": 0.00001,
"originalOrderQuoteSize": null,
"currentOrderBaseSize": 0.00001,
"currentOrderQuoteSize": null,
"remainingOrderBaseSize": 0.00001,
"remainingOrderQuoteSize": null,
"filledBaseSize": 0,
"totalFilledBaseSize": 0,
"avgFilledPrice": 0,
"time_in_force": "GTC"
},
{
"orderId": "98ed2026-55eb-4e0f-ba05-7f19818b6ed8",
"clOrderId": "",
"status": 9,
"market": "BTC-USD",
"type": 76,
"orderSide": "SELL",
"orderPrice": 61024.1,
"postOnly": false,
"timestamp": 1784891308364,
"orderDetailType": null,
"message": null,
"userQuoteCurrency": "USD",
"orderCurrency": "base",
"originalOrderBaseSize": 0.00001,
"originalOrderQuoteSize": null,
"currentOrderBaseSize": 0.00001,
"currentOrderQuoteSize": null,
"remainingOrderBaseSize": 0.00001,
"remainingOrderQuoteSize": null,
"filledBaseSize": 0,
"totalFilledBaseSize": 0,
"avgFilledPrice": 0,
"time_in_force": "GTC"
}
]

Response (Trailing)

[
{
"orderId": "9d5561c6-b603-4ee4-919c-2f0eb657f9b3",
"clOrderId": "9d5561c6-b603-4ee4-919c-2f0eb657f9b3",
"status": 9,
"market": "BTC-USD",
"type": 84,
"orderSide": "SELL",
"orderPrice": 0.00001,
"postOnly": false,
"timestamp": 1784891308521,
"orderDetailType": null,
"message": null,
"userQuoteCurrency": "USD",
"orderCurrency": "base",
"originalOrderBaseSize": 0.00001,
"originalOrderQuoteSize": null,
"currentOrderBaseSize": 0.00001,
"currentOrderQuoteSize": null,
"remainingOrderBaseSize": 0.00001,
"remainingOrderQuoteSize": null,
"filledBaseSize": 0,
"totalFilledBaseSize": 0,
"avgFilledPrice": 0,
"time_in_force": "GTC"
}
]

Response (Conditional)

[
{
"orderId": "90858596-f2b4-452b-bf23-4eee25d2a449",
"clOrderId": "",
"status": 9,
"market": "BTC-USD",
"type": 77,
"orderSide": "SELL",
"orderPrice": 0.00001,
"postOnly": false,
"timestamp": 1784891308660,
"orderDetailType": null,
"message": null,
"userQuoteCurrency": "USD",
"orderCurrency": "base",
"originalOrderBaseSize": 0.00001,
"originalOrderQuoteSize": null,
"currentOrderBaseSize": 0.00001,
"currentOrderQuoteSize": null,
"remainingOrderBaseSize": 0.00001,
"remainingOrderQuoteSize": null,
"filledBaseSize": 0,
"totalFilledBaseSize": 0,
"avgFilledPrice": 0,
"time_in_force": "GTC"
}
]

Response (Peg)

[
{
"orderId": "9ca3a6bc-0576-4af1-8ba5-d6fcab8971b1",
"clOrderId": "",
"status": 2,
"market": "BTC-USD",
"type": 80,
"orderSide": "BUY",
"orderPrice": 61024.1,
"postOnly": false,
"timestamp": 1784891308825,
"orderDetailType": null,
"message": null,
"userQuoteCurrency": "USD",
"orderCurrency": "base",
"originalOrderBaseSize": 0.00001,
"originalOrderQuoteSize": null,
"currentOrderBaseSize": 0.00001,
"currentOrderQuoteSize": null,
"remainingOrderBaseSize": 0.00001,
"remainingOrderQuoteSize": null,
"filledBaseSize": 0,
"totalFilledBaseSize": 0,
"avgFilledPrice": 0,
"time_in_force": "GTC"
}
]

Response (Twap)

[
{
"orderId": "7a53ea0a-131d-4807-b0fd-05a6a63e3114",
"clOrderId": "",
"status": 2,
"market": "BTC-USD",
"type": 82,
"orderSide": "BUY",
"orderPrice": 0,
"postOnly": false,
"timestamp": 1784891308867,
"orderDetailType": null,
"message": null,
"userQuoteCurrency": "USD",
"orderCurrency": "base",
"originalOrderBaseSize": 0.1,
"originalOrderQuoteSize": null,
"currentOrderBaseSize": 0.1,
"currentOrderQuoteSize": null,
"remainingOrderBaseSize": 0,
"remainingOrderQuoteSize": null,
"filledBaseSize": 0,
"totalFilledBaseSize": 0,
"avgFilledPrice": 0,
"time_in_force": "GTC"
}
]