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

Method fetch_order

python/ccxt/async_support/bingx.py:4187–4357  ·  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

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

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