Skip to main content

Amend Order

Unified account covers: Spot / USDT perpetual / USDC contract / Inverse contract / Option
Classic account covers: Spot / USDT perpetual / Inverse contract

important

You can only modify unfilled or partially filled orders.

Websocket logic for Spot

Classic account: if the original Spot order is a PostOnly order, and after the modification, the order becomes a taker order, then you will receive orderStatus="New" ws message first, followed by orderStatus="Rejected" ws message.

Unified account: if the original Spot order is a PostOnly order, and after the modification, the order becomes a taker order, then you will directly receive orderStatus="Rejected" ws message.

HTTP Request

POST /v5/order/amend

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type
  • Unified account: linear, inverse, spot, option
  • Classic account: linear, inverse, spot
symboltruestringSymbol name
orderIdfalsestringOrder ID. Either orderId or orderLinkId is required
orderLinkIdfalsestringUser customised order ID. Either orderId or orderLinkId is required
orderIvfalsestringImplied volatility. option only. Pass the real value, e.g for 10%, 0.1 should be passed
triggerPricefalsestring
  • For Perps & Futures, it is the conditional order trigger price. If you expect the price to rise to trigger your conditional order, make sure:
    triggerPrice > market price
    Else, triggerPrice < market price
  • For spot, it is the TP/SL and Conditional order trigger price
qtyfalsestringOrder quantity after modification. Do not pass it if not modify the qty
pricefalsestringOrder price after modification. Do not pass it if not modify the price
tpslModefalsestringTP/SL mode
  • Full: entire position for TP/SL. Then, tpOrderType or slOrderType must be Market
  • Partial: partial position tp/sl. Limit TP/SL order are supported. Note: When create limit tp/sl, tpslMode is required and it must be Partial
Valid for linear & inverse
takeProfitfalsestringTake profit price after modification. If pass "0", it means cancel the existing take profit of the order. Do not pass it if you do not want to modify the take profit. valid for spot(UTA), linear, inverse
stopLossfalsestringStop loss price after modification. If pass "0", it means cancel the existing stop loss of the order. Do not pass it if you do not want to modify the stop loss. valid for spot(UTA), linear, inverse
tpTriggerByfalsestringThe price type to trigger take profit. When set a take profit, this param is required if no initial value for the order
slTriggerByfalsestringThe price type to trigger stop loss. When set a take profit, this param is required if no initial value for the order
triggerByfalsestringTrigger price type
tpLimitPricefalsestringLimit order price when take profit is triggered. Only working when original order sets partial limit tp/sl. valid for spot(UTA), linear, inverse
slLimitPricefalsestringLimit order price when stop loss is triggered. Only working when original order sets partial limit tp/sl. valid for spot(UTA), linear, inverse

Response Parameters

ParameterTypeComments
orderIdstringOrder ID
orderLinkIdstringUser customised order ID

Request Example

POST /v5/order/amend HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672217108106
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json

{
"category": "linear",
"symbol": "ETHPERP",
"orderLinkId": "linear-004",
"triggerPrice": "1145",
"qty": "0.15",
"price": "1050",
"takeProfit": "0",
"stopLoss": "0"
}

Response Example

{
"retCode": 0,
"retMsg": "OK",
"result": {
"orderId": "c6f055d9-7f21-4079-913d-e6523a9cfffa",
"orderLinkId": "linear-004"
},
"retExtInfo": {},
"time": 1672217093461
}