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

Method edit_order

python/ccxt/async_support/bitget.py:5458–5654  ·  view source on GitHub ↗

edit a trade order https://www.bitget.com/api-doc/spot/plan/Modify-Plan-Order https://www.bitget.com/api-doc/spot/trade/Cancel-Replace-Order https://www.bitget.com/api-doc/contract/trade/Modify-Order https://www.bitget.com/api-doc/contract/plan/Modify-Tpsl-O

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

Source from the content-addressed store, hash-verified

5456 return self.parse_orders(both, market)
5457
5458 async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
5459 """
5460 edit a trade order
5461
5462 https://www.bitget.com/api-doc/spot/plan/Modify-Plan-Order
5463 https://www.bitget.com/api-doc/spot/trade/Cancel-Replace-Order
5464 https://www.bitget.com/api-doc/contract/trade/Modify-Order
5465 https://www.bitget.com/api-doc/contract/plan/Modify-Tpsl-Order
5466 https://www.bitget.com/api-doc/contract/plan/Modify-Plan-Order
5467 https://www.bitget.com/api-doc/uta/trade/Modify-Order
5468 https://www.bitget.com/api-doc/uta/strategy/Modify-Strategy-Order
5469
5470 :param str id: cancel order id
5471 :param str symbol: unified symbol of the market to create an order in
5472 :param str type: 'market' or 'limit'
5473 :param str side: 'buy' or 'sell'
5474 :param float amount: how much you want to trade in units of the base currency
5475 :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
5476 :param dict [params]: extra parameters specific to the exchange API endpoint
5477 :param float [params.triggerPrice]: the price that a trigger order is triggered at
5478 :param float [params.stopLossPrice]: *swap only* The price at which a stop loss order is triggered at
5479 :param float [params.takeProfitPrice]: *swap only* The price at which a take profit order is triggered at
5480 :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered(perpetual swap markets only)
5481 :param float [params.takeProfit.triggerPrice]: *swap only* take profit trigger price
5482 :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered(perpetual swap markets only)
5483 :param float [params.stopLoss.triggerPrice]: *swap only* stop loss trigger price
5484 :param float [params.stopLoss.price]: *swap only* the execution price for a stop loss attached to a trigger order
5485 :param float [params.takeProfit.price]: *swap only* the execution price for a take profit attached to a trigger order
5486 :param str [params.stopLoss.type]: *swap only* the type for a stop loss attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price'
5487 :param str [params.takeProfit.type]: *swap only* the type for a take profit attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price'
5488 :param str [params.trailingPercent]: *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10
5489 :param str [params.trailingTriggerPrice]: *swap and future only* the price to trigger a trailing stop order, default uses the price argument
5490 :param str [params.newTriggerType]: *swap and future only* 'fill_price', 'mark_price' or 'index_price'
5491 :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False
5492 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
5493 """
5494 await self.load_markets()
5495 market = self.market(symbol)
5496 request = {
5497 # 'orderId': id,
5498 }
5499 clientOrderId = self.safe_string_2(params, 'clientOrderId', 'clientOid')
5500 if clientOrderId is not None:
5501 params = self.omit(params, ['clientOrderId'])
5502 request['clientOid'] = clientOrderId
5503 else:
5504 request['orderId'] = id
5505 isMarketOrder = type == 'market'
5506 triggerPrice = self.safe_value_2(params, 'stopPrice', 'triggerPrice')
5507 isTriggerOrder = triggerPrice is not None
5508 stopLossPrice = self.safe_value(params, 'stopLossPrice')
5509 isStopLossOrder = stopLossPrice is not None
5510 takeProfitPrice = self.safe_value(params, 'takeProfitPrice')
5511 isTakeProfitOrder = takeProfitPrice is not None
5512 stopLoss = self.safe_value(params, 'stopLoss')
5513 takeProfit = self.safe_value(params, 'takeProfit')
5514 hasStopLoss = stopLoss is not None
5515 hasTakeProfit = takeProfit is not None

Callers

nothing calls this directly

Calls 15

parse_orderMethod · 0.95
ExchangeErrorClass · 0.90
InvalidOrderClass · 0.90
NotSupportedClass · 0.90
BadRequestClass · 0.90
safe_string_2Method · 0.80
safe_value_2Method · 0.80
safe_valueMethod · 0.80
safe_stringMethod · 0.80
safe_boolMethod · 0.80

Tested by

no test coverage detected