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

Method edit_order_request

python/ccxt/gate.py:4506–4537  ·  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

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

Callers 1

edit_orderMethod · 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