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

Method fetch_order

python/ccxt/bingx.py:4186–4356  ·  view source on GitHub ↗

fetches information on an order made by the user https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20details https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20details https://bingx-api.github.io/docs-v3/#/e

(self, id: str, symbol: Str = None, params={})

Source from the content-addressed store, hash-verified

4184 return response
4185
4186 def fetch_order(self, id: str, symbol: Str = None, params={}):
4187 """
4188 fetches information on an order made by the user
4189
4190 https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20details
4191 https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20details
4192 https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/TWAP%20Order%20Details
4193 https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Order
4194
4195 :param str id: the order id
4196 :param str symbol: unified symbol of the market the order was made in
4197 :param dict [params]: extra parameters specific to the exchange API endpoint
4198 :param boolean [params.twap]: if fetching twap order
4199 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
4200 """
4201 self.load_markets()
4202 isTwapOrder = self.safe_bool(params, 'twap', False)
4203 params = self.omit(params, 'twap')
4204 response = None
4205 market = None
4206 if isTwapOrder:
4207 twapRequest = {
4208 'mainOrderId': id,
4209 }
4210 response = self.swapV1PrivateGetTwapOrderDetail(self.extend(twapRequest, params))
4211 #
4212 # {
4213 # "code": 0,
4214 # "msg": "success cancel order",
4215 # "timestamp": 1732760856617,
4216 # "data": {
4217 # "symbol": "LTC-USDT",
4218 # "mainOrderId": "5596903086063901779",
4219 # "side": "BUY",
4220 # "positionSide": "LONG",
4221 # "priceType": "constant",
4222 # "priceVariance": "10.00",
4223 # "triggerPrice": "120.00",
4224 # "interval": 8,
4225 # "amountPerOrder": "0.5",
4226 # "totalAmount": "1.0",
4227 # "orderStatus": "Filled",
4228 # "executedQty": "1.0",
4229 # "duration": 16,
4230 # "maxDuration": 86400,
4231 # "createdTime": 1732693017000,
4232 # "updateTime": 1732693033000
4233 # }
4234 # }
4235 #
4236 else:
4237 if symbol is None:
4238 raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
4239 market = self.market(symbol)
4240 request = {
4241 'symbol': market['id'],
4242 'orderId': id,
4243 }

Callers

nothing calls this directly

Calls 14

parse_orderMethod · 0.95
ArgumentsRequiredClass · 0.90
safe_boolMethod · 0.80
safe_dictMethod · 0.80
load_marketsMethod · 0.45
omitMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected