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

Method edit_order

python/ccxt/bingx.py:6138–6272  ·  view source on GitHub ↗

cancels an order and places a new order https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20an%20Existing%20Order%20and%20Send%20a%20New%20Order # spot https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20an%20Existing%20Order%20a

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

Source from the content-addressed store, hash-verified

6136 return self.swapV1PrivatePostPositionSideDual(self.extend(request, params))
6137
6138 def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order:
6139 """
6140 cancels an order and places a new order
6141
6142 https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20an%20Existing%20Order%20and%20Send%20a%20New%20Order # spot
6143 https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20an%20Existing%20Order%20and%20Send%20a%20New%20Orde # swap
6144
6145 :param str id: order id
6146 :param str symbol: unified symbol of the market to create an order in
6147 :param str type: 'market' or 'limit'
6148 :param str side: 'buy' or 'sell'
6149 :param float amount: how much of the currency you want to trade in units of the base currency
6150 :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
6151 :param dict [params]: extra parameters specific to the exchange API endpoint
6152 :param str [params.triggerPrice]: Trigger price used for TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET order types.
6153 :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
6154 :param float [params.takeProfit.triggerPrice]: take profit trigger price
6155 :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
6156 :param float [params.stopLoss.triggerPrice]: stop loss trigger price
6157
6158 EXCHANGE SPECIFIC PARAMETERS
6159 :param str [params.cancelClientOrderID]: the user-defined id of the order to be canceled, 1-40 characters, different orders cannot use the same clientOrderID, only supports a query range of 2 hours
6160 :param str [params.cancelRestrictions]: cancel orders with specified status, NEW: New order, PENDING: Pending order, PARTIALLY_FILLED: Partially filled
6161 :param str [params.cancelReplaceMode]: STOP_ON_FAILURE - if the cancel order fails, it will not continue to place a new order, ALLOW_FAILURE - regardless of whether the cancel order succeeds or fails, it will continue to place a new order
6162 :param float [params.quoteOrderQty]: order amount
6163 :param str [params.newClientOrderId]: custom order id consisting of letters, numbers, and _, 1-40 characters, different orders cannot use the same newClientOrderId.
6164 :param str [params.positionSide]: *contract only* position direction, required for single position, for both long and short positions only LONG or SHORT can be chosen, defaults to LONG if empty
6165 :param str [params.reduceOnly]: *contract only* True or False, default=false for single position mode. self parameter is not accepted for both long and short positions mode
6166 :param float [params.priceRate]: *contract only* for type TRAILING_STOP_Market or TRAILING_TP_SL, Max = 1
6167 :param str [params.workingType]: *contract only* StopPrice trigger price types, MARK_PRICE(default), CONTRACT_PRICE, or INDEX_PRICE
6168 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
6169 """
6170 self.load_markets()
6171 market = self.market(symbol)
6172 request = self.create_order_request(symbol, type, side, amount, price, params)
6173 request['cancelOrderId'] = id
6174 request['cancelReplaceMode'] = 'STOP_ON_FAILURE'
6175 response: dict
6176 if market['swap']:
6177 response = self.swapV1PrivatePostTradeCancelReplace(self.extend(request, params))
6178 #
6179 # {
6180 # code: '0',
6181 # msg: '',
6182 # data: {
6183 # cancelResult: 'true',
6184 # cancelMsg: '',
6185 # cancelResponse: {
6186 # cancelClientOrderId: '',
6187 # cancelOrderId: '1755336244265705472',
6188 # symbol: 'SOL-USDT',
6189 # orderId: '1755336244265705472',
6190 # side: 'SELL',
6191 # positionSide: 'SHORT',
6192 # type: 'LIMIT',
6193 # origQty: '1',
6194 # price: '100.000',
6195 # executedQty: '0',

Callers

nothing calls this directly

Calls 8

create_order_requestMethod · 0.95
parse_orderMethod · 0.95
safe_dictMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected