MCPcopy Create free account
hub / github.com/ccxt/ccxt / edit_order

Method edit_order

python/ccxt/bybit.py:4405–4456  ·  view source on GitHub ↗

edit a trade order https://bybit-exchange.github.io/docs/v5/order/amend-order https://bybit-exchange.github.io/docs/derivatives/unified/replace-order https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order :param str id:

(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={})

Source from the content-addressed store, hash-verified

4403 return request
4404
4405 def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order:
4406 """
4407 edit a trade order
4408
4409 https://bybit-exchange.github.io/docs/v5/order/amend-order
4410 https://bybit-exchange.github.io/docs/derivatives/unified/replace-order
4411 https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order
4412
4413 :param str id: cancel order id
4414 :param str symbol: unified symbol of the market to create an order in
4415 :param str type: 'market' or 'limit'
4416 :param str side: 'buy' or 'sell'
4417 :param float amount: how much of currency you want to trade in units of base currency
4418 :param float price: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
4419 :param dict [params]: extra parameters specific to the exchange API endpoint
4420 :param str [params.clientOrderId]: unique client order id
4421 :param float [params.triggerPrice]: The price that a trigger order is triggered at
4422 :param float [params.stopLossPrice]: The price that a stop loss order is triggered at
4423 :param float [params.takeProfitPrice]: The price that a take profit order is triggered at
4424 :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered
4425 :param float [params.takeProfit.triggerPrice]: take profit trigger price
4426 :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered
4427 :param float [params.stopLoss.triggerPrice]: stop loss trigger price
4428 :param str [params.triggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
4429 :param str [params.slTriggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
4430 :param str [params.tpTriggerby]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
4431 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
4432 """
4433 self.load_markets()
4434 if symbol is None:
4435 raise ArgumentsRequired(self.id + ' editOrder() requires a symbol argument')
4436 market = self.market(symbol)
4437 request = self.edit_order_request(id, symbol, type, side, amount, price, params)
4438 response = self.privatePostV5OrderAmend(self.extend(request, params))
4439 #
4440 # {
4441 # "retCode": 0,
4442 # "retMsg": "OK",
4443 # "result": {
4444 # "orderId": "c6f055d9-7f21-4079-913d-e6523a9cfffa",
4445 # "orderLinkId": "linear-004"
4446 # },
4447 # "retExtInfo": {},
4448 # "time": 1672217093461
4449 # }
4450 #
4451 result = self.safe_dict(response, 'result', {})
4452 return self.safe_order({
4453 'info': response,
4454 'id': self.safe_string(result, 'orderId'),
4455 'clientOrderId': self.safe_string(result, 'orderLinkId'),
4456 }, market)
4457
4458 def edit_orders(self, orders: List[OrderRequest], params={}) -> List[Order]:
4459 """

Callers

nothing calls this directly

Calls 9

edit_order_requestMethod · 0.95
ArgumentsRequiredClass · 0.90
safe_dictMethod · 0.80
safe_orderMethod · 0.80
safe_stringMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected