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

Method edit_order_request

python/ccxt/async_support/gate.py:4507–4538  ·  view source on GitHub ↗
(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={})

Source from the content-addressed store, hash-verified

4505 return await self.create_order(symbol, 'market', 'buy', cost, None, params)
4506
4507 def edit_order_request(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
4508 market = self.market(symbol)
4509 marketType = None
4510 marketType, params = self.handle_market_type_and_params('editOrder', market, params)
4511 account = self.convert_type_to_account(marketType)
4512 isUnifiedAccount = False
4513 isUnifiedAccount, params = self.handle_option_and_params(params, 'editOrder', 'unifiedAccount')
4514 if isUnifiedAccount:
4515 account = 'unified'
4516 isLimitOrder = (type == 'limit')
4517 if account == 'spot':
4518 if not isLimitOrder:
4519 # exchange doesn't have market orders for spot
4520 raise InvalidOrder(self.id + ' editOrder() does not support ' + type + ' orders for ' + marketType + ' markets')
4521 request = {
4522 'order_id': str(id),
4523 'currency_pair': market['id'],
4524 'account': account,
4525 }
4526 if amount is not None:
4527 if market['spot']:
4528 request['amount'] = self.amount_to_precision(symbol, amount)
4529 else:
4530 if side == 'sell':
4531 request['size'] = self.parse_to_numeric(Precise.string_neg(self.amount_to_precision(symbol, amount)))
4532 else:
4533 request['size'] = self.parse_to_numeric(self.amount_to_precision(symbol, amount))
4534 if price is not None:
4535 request['price'] = self.price_to_precision(symbol, price)
4536 if not market['spot']:
4537 request['settle'] = market['settleId']
4538 return self.extend(request, params)
4539
4540 async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
4541 """

Callers 2

edit_orderMethod · 0.95
edit_order_wsMethod · 0.95

Calls 10

InvalidOrderClass · 0.90
parse_to_numericMethod · 0.80
string_negMethod · 0.80
marketMethod · 0.45
amount_to_precisionMethod · 0.45
price_to_precisionMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected