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

Method edit_order

python/ccxt/async_support/bybit.py:4406–4457  ·  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

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

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