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

Method edit_contract_order

python/ccxt/binance.py:5375–5437  ·  view source on GitHub ↗

edit a trade order https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Order https://developers.binance.com/docs/derivatives/por

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

Source from the content-addressed store, hash-verified

5373 return request
5374
5375 def edit_contract_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
5376 """
5377 edit a trade order
5378
5379 https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order
5380 https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Order
5381 https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-UM-Order
5382 https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-CM-Order
5383
5384 :param str id: cancel order id
5385 :param str symbol: unified symbol of the market to create an order in
5386 :param str type: 'market' or 'limit'
5387 :param str side: 'buy' or 'sell'
5388 :param float amount: how much of currency you want to trade in units of base currency
5389 :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
5390 :param dict [params]: extra parameters specific to the exchange API endpoint
5391 :param boolean [params.portfolioMargin]: set to True if you would like to edit an order in a portfolio margin account
5392 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
5393 """
5394 self.load_markets()
5395 market = self.market(symbol)
5396 isPortfolioMargin = None
5397 isPortfolioMargin, params = self.handle_option_and_params_2(params, 'editContractOrder', 'papi', 'portfolioMargin', False)
5398 request = self.edit_contract_order_request(id, symbol, type, side, amount, price, params)
5399 response = None
5400 if market['linear']:
5401 if isPortfolioMargin:
5402 response = self.papiPutUmOrder(self.extend(request, params))
5403 else:
5404 response = self.fapiPrivatePutOrder(self.extend(request, params))
5405 elif market['inverse']:
5406 if isPortfolioMargin:
5407 response = self.papiPutCmOrder(self.extend(request, params))
5408 else:
5409 response = self.dapiPrivatePutOrder(self.extend(request, params))
5410 #
5411 # swap and future
5412 #
5413 # {
5414 # "orderId": 151007482392,
5415 # "symbol": "BTCUSDT",
5416 # "status": "NEW",
5417 # "clientOrderId": "web_pCCGp9AIHjziKLlpGpXI",
5418 # "price": "25000",
5419 # "avgPrice": "0.00000",
5420 # "origQty": "0.001",
5421 # "executedQty": "0",
5422 # "cumQty": "0",
5423 # "cumQuote": "0",
5424 # "timeInForce": "GTC",
5425 # "type": "LIMIT",
5426 # "reduceOnly": False,
5427 # "closePosition": False,
5428 # "side": "BUY",
5429 # "positionSide": "BOTH",
5430 # "stopPrice": "0",
5431 # "workingType": "CONTRACT_PRICE",
5432 # "priceProtect": False,

Callers 1

edit_orderMethod · 0.95

Calls 10

marketMethod · 0.95
papiPutUmOrderMethod · 0.95
fapiPrivatePutOrderMethod · 0.95
papiPutCmOrderMethod · 0.95
dapiPrivatePutOrderMethod · 0.95
parse_orderMethod · 0.95
load_marketsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected