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

Method edit_contract_order

python/ccxt/async_support/binance.py:5376–5438  ·  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

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