Place algo order
POST🔒 Trading
Places an algorithmic spot order (TWAP, PEG, OCO, TRAILING, or CONDITIONAL) on the given trading pair.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| BROKER-ID | String | No | Optional broker/partner identifier to tag orders placed through them |
Request Body
Conditional
| Name | Type | Required | Description |
|---|---|---|---|
| orderType | String | Yes | CONDITIONAL — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING |
| symbol | String | Yes | Trading pair, e.g. BTC-USDT |
| orderSide | String | Yes | BUY or SELL |
| triggerPrice | Double | Yes | Price that activates the order |
| triggerOrderType | String | Yes | Trigger behavior: STOP_LOSS, TAKE_PROFIT, STOP_LOSS_LIMIT, or TAKE_PROFIT_LIMIT |
| triggerPriceType | String | Yes | Reference price for the trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE) |
| clOrderId | String | No | Client-supplied order identifier, echoed in the response (max 64 characters) |
| orderSize | Double | No | Order quantity in base currency; required for SELL market and for the STOP_LOSS_LIMIT / TAKE_PROFIT_LIMIT variants |
| quoteOrderSize | Double | No | only for market order in BUY side |
| orderPrice | Double | No | only for limit order |
| timeInForce | String | No | Time-in-force policy for the limit variants (GTC, IOC, FOK) |
| postOnly | Boolean | No | If true, reject the limit variant if it would immediately match (post-only / maker-only) |
Oco
| Name | Type | Required | Description |
|---|---|---|---|
| orderType | String | Yes | OCO — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING |
| symbol | String | Yes | Trading pair, e.g. BTC-USDT |
| orderSide | String | Yes | BUY or SELL |
| orderSize | Double | Yes | Order quantity in base currency |
| takeProfitOrderPrice | Double | Yes | Limit price of the take-profit leg |
| stopLossOrderPrice | Double | Yes | Limit price used once the stop-loss trigger fires |
| stopLossTriggerPrice | Double | Yes | Price that activates the stop-loss leg |
| stopLossTriggerPriceType | String | Yes | Reference price for the stop-loss trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE) |
| clOrderId | String | No | Client-supplied order identifier, echoed in the response (max 64 characters) |
| timeInForce | String | No | Time-in-force policy for the take-profit leg (GTC, IOC, FOK) |
| postOnly | Boolean | No | If true, reject the take-profit leg if it would immediately match (post-only / maker-only) |
Peg
| Name | Type | Required | Description |
|---|---|---|---|
| orderType | String | Yes | PEG — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING |
| symbol | String | Yes | Trading pair, e.g. BTC-USDT |
| orderSide | String | Yes | BUY or SELL |
| orderPrice | Double | Yes | Base price the order is pegged to |
| orderSize | Double | Yes | Order quantity in base currency |
| clOrderId | String | No | Client-supplied order identifier, echoed in the response (max 64 characters) |
| stealth | Double | Yes | between 1 and 100 |
| deviation | Double | No | between -10 and 10, defaults to 0 |
Trailing
| Name | Type | Required | Description |
|---|---|---|---|
| orderType | String | Yes | TRAILING — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING |
| symbol | String | Yes | Trading pair, e.g. BTC-USDT |
| orderSide | String | Yes | BUY or SELL |
| trailValue | Double | Yes | Distance the trigger price trails the extreme price; must be positive |
| trailValueType | String | Yes | Whether trailValue is an absolute distance (DISTANCE) or a percentage (PERCENTAGE) |
| triggerPriceType | String | No | Reference price used to update the trailing trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE) |
| clOrderId | String | No | Client-supplied order identifier, echoed in the response (max 64 characters) |
| orderSize | Double | No | Order quantity in base currency; only for SELL side |
| quoteOrderSize | Double | No | Order amount in quote currency; only for BUY side |
| activationTriggerPrice | Double | No | Only arm the trailing stop after the market price reaches this level |
| activationTriggerPriceType | String | No | Reference price for the activation trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE) |
Twap
| Name | Type | Required | Description |
|---|---|---|---|
| orderType | String | Yes | TWAP — LIMIT · MARKET · PEG · OCO · TWAP · CONDITIONAL · TRAILING |
| symbol | String | Yes | Trading pair, e.g. BTC-USDT |
| orderSide | String | Yes | BUY or SELL |
| orderSize | Double | Yes | Total order quantity in base currency |
| timePeriod | Long | Yes | Total execution window in seconds |
| clOrderId | String | No | Client-supplied order identifier, echoed in the response (max 64 characters) |
| makerFirst | Boolean | No | If true, place child orders as post-only first before falling back to taker |
| randomizeSize | Boolean | No | If true, randomize child order sizes to reduce predictability |
| subTwapMaxOrderSize | Double | No | Maximum size of each child order, in base currency |
| maxSpread | Double | No | Pause execution while the bid-ask spread exceeds this value |
| maxDistanceThroughBook | Double | No | 0 to 1; omit or set negative to disable, defaults to -1 (disabled) |
| pausePrice | Double | No | Pause execution when the reference price crosses this level |
| activationTriggerPrice | Double | No | Delay execution until the market price reaches this level |
| activationTriggerPriceType | String | No | Reference price for the activation trigger (LAST_PRICE, MARK_PRICE, or INDEX_PRICE) |
Response Content
| Name | Type | Description |
|---|---|---|
| orderId | String | Server-assigned order identifier |
| clOrderId | String | Echo of the client-supplied order identifier if one was provided |
| status | Integer | Numeric status code reflecting the current state of the order (e.g. filled, cancelled, rejected) |
| market | String | Trading pair, e.g. BTC-USDT |
| type | Integer | Numeric code identifying the order type (e.g. LIMIT, MARKET, TWAP, PEG) |
| orderSide | String | BUY or SELL |
| orderPrice | Double | Order price |
| postOnly | Boolean | Whether the order was submitted as post-only |
| timestamp | Long | Server-side event timestamp in epoch milliseconds |
| orderDetailType | String | Detailed order sub-type when applicable (e.g. TWAP for algo TWAP orders) |
| message | String | Optional diagnostic message; present only when one is returned (e.g. rejection reason) |
| userQuoteCurrency | String | Quote currency configured for the user |
| orderCurrency | String | 'quote' or 'base'; indicates whether the quote-size or base-size fields below are populated |
| originalOrderBaseSize | Double | Original size in base currency; populated when orderCurrency is 'base' |
| originalOrderQuoteSize | Double | Original size in quote currency; populated when orderCurrency is 'quote' |
| currentOrderBaseSize | Double | Currently active size in base currency; populated when orderCurrency is 'base' |
| currentOrderQuoteSize | Double | Currently active size in quote currency; populated when orderCurrency is 'quote' |
| remainingOrderBaseSize | Double | Remaining unfilled size in base currency; populated when orderCurrency is 'base' |
| remainingOrderQuoteSize | Double | Remaining unfilled size in quote currency; populated when orderCurrency is 'quote' |
| filledBaseSize | Double | Size filled by the most recent match, in base currency |
| totalFilledBaseSize | Double | Cumulative filled size across all matches, in base currency |
| avgFilledPrice | Double | Volume-weighted average fill price |
| time_in_force | String | Time-in-force policy (GTC, IOC, FOK); null when not applicable to the order type |
example
POST
https://api.btse.com/spot/api/v4/trade/orders/algoRequest (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"
}
]