Skip to main content

Place an algo order

Places an algorithmic order. Supported orderType variants: OCO, TRAILING, CONDITIONAL, TWAP, and PEG; each variant has its own required fields.

Headers

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

Request Body

Conditional

NameTypeRequiredDescription
orderTypeStringYesOrder type. Must be CONDITIONAL for this variant. — LIMIT · MARKET · OCO · TWAP · PEG · CONDITIONAL · TRAILING
clOrderIdStringNoClient-assigned order identifier for tracking and idempotency.
symbolStringYesTrading pair symbol.
orderSideStringYesOrder side: BUY or SELL.
orderSizeLongYesOrder size in number of contracts.
positionModeStringNoPosition mode this order applies to (one-way or hedge). — ONE_WAY · HEDGE · ISOLATED
timeInForceStringNoTime-in-force policy applied once the order is triggered. — FOK · GTC · IOC · HALFSEC · HALFMIN · FIVEMIN · HOUR · TWELVEHOUR · DAY · WEEK · MONTH
reduceOnlyBooleanNoIf true, the order can only reduce an existing position and cannot open or increase one.
postOnlyBooleanNoIf true, the triggered order is rejected if it would take liquidity, ensuring maker-only execution.
orderPriceDoubleNoLimit price used once the order is triggered. Omit for a market-style trigger.
triggerPriceDoubleNoPrice at which the order becomes active.
triggerTypeStringNoReference price type used to evaluate the trigger. — INDEX_PRICE · LAST_PRICE · MARK_PRICE
takeProfitTriggerTypeStringNoReference price type used to evaluate the take-profit trigger. — INDEX_PRICE · LAST_PRICE · MARK_PRICE
stopLossTriggerTypeStringNoReference price type used to evaluate the stop-loss trigger. — INDEX_PRICE · LAST_PRICE · MARK_PRICE
takeProfitTriggerPriceDoubleNoTake-profit trigger price attached to the resulting order.
stopLossTriggerPriceDoubleNoStop-loss trigger price attached to the resulting order.

OcO

NameTypeRequiredDescription
orderTypeStringYesOrder type. Must be OCO for this variant. — LIMIT · MARKET · OCO · TWAP · PEG · CONDITIONAL · TRAILING
clOrderIdStringNoClient-assigned order identifier for tracking and idempotency.
symbolStringYesTrading pair symbol.
orderSideStringYesOrder side: BUY or SELL.
orderSizeLongYesOrder size in number of contracts.
positionModeStringNoPosition mode this order applies to (one-way or hedge). — ONE_WAY · HEDGE · ISOLATED
timeInForceStringNoTime-in-force policy applied to each leg once triggered. — FOK · GTC · IOC · HALFSEC · HALFMIN · FIVEMIN · HOUR · TWELVEHOUR · DAY · WEEK · MONTH
reduceOnlyBooleanNoIf true, both legs can only reduce an existing position.
postOnlyBooleanNoIf true, each leg is rejected if it would take liquidity, ensuring maker-only execution.
takeProfitOrderPriceDoubleYesLimit price of the take-profit leg.
stopLossOrderPriceDoubleYesLimit price of the stop-loss leg once triggered.
stopLossTriggerPriceDoubleYesPrice at which the stop-loss leg is triggered.
stopLossTriggerTypeStringNoReference price type used to evaluate the stop-loss trigger. — INDEX_PRICE · LAST_PRICE · MARK_PRICE

Peg

NameTypeRequiredDescription
orderTypeStringYesOrder type. Must be PEG for this variant. — LIMIT · MARKET · OCO · TWAP · PEG · CONDITIONAL · TRAILING
clOrderIdStringNoClient-assigned order identifier for tracking and idempotency.
symbolStringYesTrading pair symbol.
orderSideStringYesOrder side: BUY or SELL.
orderSizeLongYesOrder size in number of contracts.
positionModeStringNoPosition mode this order applies to (one-way or hedge). — ONE_WAY · HEDGE · ISOLATED
orderPriceDoubleNoOptional worst-price limit; the pegged price will not cross this bound.
deviationDoubleYesOffset applied to the pegged reference price.
stealthDoubleYesPortion of the order size displayed on the book; the remainder is hidden.

Trailing

NameTypeRequiredDescription
orderTypeStringYesOrder type. Must be TRAILING for this variant. — LIMIT · MARKET · OCO · TWAP · PEG · CONDITIONAL · TRAILING
clOrderIdStringNoClient-assigned order identifier for tracking and idempotency.
symbolStringYesTrading pair symbol.
orderSideStringYesOrder side: BUY or SELL.
orderSizeLongYesOrder size in number of contracts.
positionModeStringNoPosition mode this order applies to (one-way or hedge). — ONE_WAY · HEDGE · ISOLATED
reduceOnlyBooleanNoIf true, the order can only reduce an existing position and cannot open or increase one.
trailValueDoubleYesTrailing distance the stop price maintains from the best reached reference price.
trailValueTypeStringYesHow trailValue is interpreted (absolute price offset or percentage). — DISTANCE · PERCENTAGE
trailTriggerPriceTypeStringYesReference price type used to evaluate the trailing trigger. — INDEX_PRICE · LAST_PRICE · MARK_PRICE
activationTriggerPriceDoubleNoOptional price at which the trailing logic starts. Trailing is inactive until this price is reached.
activationTriggerTypeStringNoReference price type used to evaluate the activation price. — INDEX_PRICE · LAST_PRICE · MARK_PRICE

Twap

NameTypeRequiredDescription
orderTypeStringYesOrder type. Must be TWAP for this variant. — LIMIT · MARKET · OCO · TWAP · PEG · CONDITIONAL · TRAILING
clOrderIdStringNoClient-assigned order identifier for tracking and idempotency.
symbolStringYesTrading pair symbol.
orderSideStringYesOrder side: BUY or SELL.
orderSizeLongYesTotal order size in number of contracts, distributed across child orders.
reduceOnlyBooleanNoIf true, the order can only reduce an existing position and cannot open or increase one.
timePeriodLongNoTotal execution window in seconds over which child orders are dispatched.
randomizeSizeBooleanNoIf true, individual child order sizes are randomized within limits to reduce predictability.
subTwapMaxOrderSizeDoubleNoMaximum size of each child order.
maxSpreadDoubleNoMaximum acceptable bid-ask spread. Child orders are paused when the spread is wider.
makerFirstBooleanNoIf true, child orders prefer maker execution before falling back to taker behavior.
maxDistanceThroughBookDoubleNoMaximum distance a child order may cross into the order book.
pausePriceDoubleNoReference price beyond which the TWAP schedule pauses to avoid adverse execution.
activationTriggerPriceDoubleNoOptional price at which the TWAP schedule begins. Inactive until this price is reached.
activationTriggerTypeStringNoReference price type used to evaluate the activation price. — INDEX_PRICE · LAST_PRICE · MARK_PRICE

Response Content

NameTypeDescription
statusIntegerOrder status code returned for this placement.
typeIntegerOrder type code.
symbolStringTrading pair symbol.
postOnlyBooleanTrue if the order was accepted as maker-only.
orderSideStringOrder side: BUY or SELL.
orderIdStringServer-assigned order id.
clOrderIDStringClient-assigned order id echoed from the request.
timestampLongServer timestamp of the placement, in milliseconds since epoch.
priceDoubleLimit price submitted with the order.
avgFilledPriceDoubleAverage fill price across executions so far. Zero if nothing has filled.
messageStringHuman-readable message returned by the platform (e.g. rejection reason).
originalOrderSizeLongOriginal order size in number of contracts as submitted.
currentOrderSizeLongCurrent remaining order size after fills or amendments.
filledSizeLongSize filled in the most recent match, in contracts.
totalFilledSizeLongCumulative filled size across all matches, in contracts.
remainingSizeLongRemaining unfilled size, in contracts.
positionModeStringPosition mode this order applies to (one-way or hedge). — ONE_WAY · HEDGE · ISOLATED
positionDirectionStringPosition direction the order will affect: LONG or SHORT.
positionIdStringIdentifier of the position the order is bound to.
timeInForceStringTime-in-force policy applied to the order (e.g. GTC, IOC, FOK).
example
POSThttps://api.btse.com/futures/api/v3/trade/orders/algo

Request (Conditional)

{
"symbol": "BTC-PERP",
"orderType": "CONDITIONAL",
"orderSide": "SELL",
"orderSize": 1,
"reduceOnly": true,
"triggerPrice": 63010.5,
"triggerType": "MARK_PRICE"
}

Request (OCO)

{
"symbol": "BTC-PERP",
"orderType": "OCO",
"orderSide": "SELL",
"orderSize": 1,
"reduceOnly": true,
"takeProfitOrderPrice": 63010.5,
"stopLossOrderPrice": 57009.5,
"stopLossTriggerPrice": 57009.5,
"stopLossTriggerType": "MARK_PRICE"
}

Request (Trailing)

{
"symbol": "BTC-PERP",
"orderType": "TRAILING",
"orderSide": "SELL",
"orderSize": 1,
"reduceOnly": true,
"trailValue": 3000.5,
"trailValueType": "DISTANCE",
"trailTriggerPriceType": "MARK_PRICE",
"activationTriggerPrice": 63010.5,
"activationTriggerType": "MARK_PRICE"
}

Request (Twap)

{
"symbol": "BTC-PERP",
"orderType": "TWAP",
"orderSide": "SELL",
"orderSize": 1,
"reduceOnly": true,
"timePeriod": 3600,
"activationTriggerPrice": 63010.5,
"activationTriggerType": "MARK_PRICE"
}

Request (Peg)

{
"symbol": "BTC-PERP",
"orderType": "PEG",
"orderSide": "BUY",
"orderSize": 1,
"orderPrice": 57009.5,
"deviation": 0,
"stealth": 1
}

Response (Conditional)

{
"status": 9,
"type": 0,
"symbol": "BTC-PERP",
"postOnly": false,
"orderSide": "SELL",
"orderId": "5591478a-c3ed-45b6-a1d4-f14404996d51",
"clOrderID": "",
"timestamp": 1784882344679,
"price": 0,
"avgFilledPrice": 0,
"message": null,
"originalOrderSize": 1,
"currentOrderSize": 1,
"filledSize": 0,
"totalFilledSize": 0,
"remainingSize": 1,
"positionMode": "ONE_WAY",
"positionDirection": null,
"positionId": "BTC-PERP-USDT",
"timeInForce": "GTC"
}

Response (OCO)

{
"status": 2,
"type": 0,
"symbol": "BTC-PERP",
"postOnly": false,
"orderSide": "SELL",
"orderId": "cfb7efd5-59d3-45d1-9eb3-a053d644108a",
"clOrderID": "",
"timestamp": 1784882344747,
"price": 63010.5,
"avgFilledPrice": 0,
"message": null,
"originalOrderSize": 1,
"currentOrderSize": 1,
"filledSize": 0,
"totalFilledSize": 0,
"remainingSize": 1,
"positionMode": "ONE_WAY",
"positionDirection": null,
"positionId": "BTC-PERP-USDT",
"timeInForce": "GTC"
}

Response (Trailing)

{
"status": 9,
"type": 0,
"symbol": "BTC-PERP",
"postOnly": false,
"orderSide": "SELL",
"orderId": "2c6a3aaf-d0c5-46f7-a71d-cda3ffc62cbb",
"clOrderID": "2c6a3aaf-d0c5-46f7-a71d-cda3ffc62cbb",
"timestamp": 1784882344836,
"price": 0,
"avgFilledPrice": 0,
"message": null,
"originalOrderSize": 1,
"currentOrderSize": 1,
"filledSize": 0,
"totalFilledSize": 0,
"remainingSize": 1,
"positionMode": "ONE_WAY",
"positionDirection": null,
"positionId": "BTC-PERP-USDT",
"timeInForce": "GTC"
}

Response (Twap)

{
"status": 9,
"type": 0,
"symbol": "BTC-PERP",
"postOnly": false,
"orderSide": "SELL",
"orderId": "4196fd02-5bd0-48e9-acba-496d88dd64f0",
"clOrderID": "4196fd02-5bd0-48e9-acba-496d88dd64f0",
"timestamp": 1784882344913,
"price": 0,
"avgFilledPrice": 0,
"message": null,
"originalOrderSize": 1,
"currentOrderSize": 1,
"filledSize": 0,
"totalFilledSize": 0,
"remainingSize": 1,
"positionMode": "ONE_WAY",
"positionDirection": null,
"positionId": "BTC-PERP-USDT",
"timeInForce": "GTC"
}

Response (Peg)

{
"status": 2,
"type": 0,
"symbol": "BTC-PERP",
"postOnly": false,
"orderSide": "BUY",
"orderId": "484fd831-8399-4b25-933a-8a5dd111e488",
"clOrderID": "",
"timestamp": 1784882344954,
"price": 57009.5,
"avgFilledPrice": 0,
"message": null,
"originalOrderSize": 1,
"currentOrderSize": 1,
"filledSize": 0,
"totalFilledSize": 0,
"remainingSize": 1,
"positionMode": "ONE_WAY",
"positionDirection": null,
"positionId": "BTC-PERP-USDT",
"timeInForce": "GTC"
}