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

Method fetch_order

python/ccxt/async_support/xt.py:2504–2674  ·  view source on GitHub ↗

fetches information on an order made by the user https://doc.xt.com/#orderorderGet https://doc.xt.com/#futures_ordergetById https://doc.xt.com/#futures_entrustgetPlanById https://doc.xt.com/#futures_entrustgetProfitById :param str id: order id

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

Source from the content-addressed store, hash-verified

2502 return self.parse_order(response, market)
2503
2504 async def fetch_order(self, id: str, symbol: Str = None, params={}):
2505 """
2506 fetches information on an order made by the user
2507
2508 https://doc.xt.com/#orderorderGet
2509 https://doc.xt.com/#futures_ordergetById
2510 https://doc.xt.com/#futures_entrustgetPlanById
2511 https://doc.xt.com/#futures_entrustgetProfitById
2512
2513 :param str id: order id
2514 :param str [symbol]: unified symbol of the market the order was made in
2515 :param dict params: extra parameters specific to the xt api endpoint
2516 :param bool [params.trigger]: if the order is a trigger order or not
2517 :param bool [params.stopLossTakeProfit]: if the order is a stop-loss or take-profit order
2518 :returns dict: An `order structure <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
2519 """
2520 await self.load_markets()
2521 market = None
2522 if symbol is not None:
2523 market = self.market(symbol)
2524 request = {}
2525 type = None
2526 subType = None
2527 response = None
2528 type, params = self.handle_market_type_and_params('fetchOrder', market, params)
2529 subType, params = self.handle_sub_type_and_params('fetchOrder', market, params)
2530 trigger = self.safe_value(params, 'stop')
2531 stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
2532 if trigger:
2533 request['entrustId'] = id
2534 elif stopLossTakeProfit:
2535 request['profitId'] = id
2536 else:
2537 request['orderId'] = id
2538 if trigger:
2539 params = self.omit(params, 'stop')
2540 if subType == 'inverse':
2541 response = await self.privateInverseGetFutureTradeV1EntrustPlanDetail(self.extend(request, params))
2542 else:
2543 response = await self.privateLinearGetFutureTradeV1EntrustPlanDetail(self.extend(request, params))
2544 elif stopLossTakeProfit:
2545 params = self.omit(params, 'stopLossTakeProfit')
2546 if subType == 'inverse':
2547 response = await self.privateInverseGetFutureTradeV1EntrustProfitDetail(self.extend(request, params))
2548 else:
2549 response = await self.privateLinearGetFutureTradeV1EntrustProfitDetail(self.extend(request, params))
2550 elif subType == 'inverse':
2551 response = await self.privateInverseGetFutureTradeV1OrderDetail(self.extend(request, params))
2552 elif (subType == 'linear') or (type == 'swap') or (type == 'future'):
2553 response = await self.privateLinearGetFutureTradeV1OrderDetail(self.extend(request, params))
2554 else:
2555 response = await self.privateSpotGetOrderOrderId(self.extend(request, params))
2556 #
2557 # spot
2558 #
2559 # {
2560 # "rc": 0,
2561 # "mc": "SUCCESS",

Callers 6

tco_try_cancel_orderFunction · 0.45
tco_try_cancel_orderFunction · 0.45

Tested by 6

tco_try_cancel_orderFunction · 0.36
tco_try_cancel_orderFunction · 0.36