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

Method fetch_order

python/ccxt/gate.py:4966–5015  ·  view source on GitHub ↗

Retrieves information on an order https://www.gate.com/docs/developers/apiv4/en/#query-single-order-details https://www.gate.com/docs/developers/apiv4/en/#query-single-auto-order-details https://www.gate.com/docs/developers/apiv4/en/#query-single-order-details-2

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

Source from the content-addressed store, hash-verified

4964 return [request, requestParams]
4965
4966 def fetch_order(self, id: str, symbol: Str = None, params={}):
4967 """
4968 Retrieves information on an order
4969
4970 https://www.gate.com/docs/developers/apiv4/en/#query-single-order-details
4971 https://www.gate.com/docs/developers/apiv4/en/#query-single-auto-order-details
4972 https://www.gate.com/docs/developers/apiv4/en/#query-single-order-details-2
4973 https://www.gate.com/docs/developers/apiv4/en/#query-single-auto-order-details-2
4974 https://www.gate.com/docs/developers/apiv4/en/#query-single-order-details-3
4975 https://www.gate.com/docs/developers/apiv4/en/#query-single-auto-order-details-3
4976 https://www.gate.com/docs/developers/apiv4/en/#query-single-order-details-4
4977
4978 :param str id: Order id
4979 :param str symbol: Unified market symbol, *required for spot and margin*
4980 :param dict [params]: Parameters specified by the exchange api
4981 :param bool [params.trigger]: True if the order being fetched is a trigger order
4982 :param str [params.marginMode]: 'cross' or 'isolated' - marginMode for margin trading if not provided self.options['defaultMarginMode'] is used
4983 :param str [params.type]: 'spot', 'swap', or 'future', if not provided self.options['defaultMarginMode'] is used
4984 :param str [params.settle]: 'btc' or 'usdt' - settle currency for perpetual swap and future - market settle currency is used if symbol is not None, default="usdt" for swap and "btc" for future
4985 :param bool [params.unifiedAccount]: set to True for fetching a unified account order
4986 :returns: An `order structure <https://docs.ccxt.com/?id=order-structure>`
4987 """
4988 self.load_markets()
4989 self.load_unified_status()
4990 market = None if (symbol is None) else self.market(symbol)
4991 result = self.handle_market_type_and_params('fetchOrder', market, params)
4992 type = self.safe_string(result, 0)
4993 trigger = self.safe_bool_n(params, ['trigger', 'is_stop_order', 'stop'], False)
4994 request, requestParams = self.fetch_order_request(id, symbol, params)
4995 response: dict
4996 if type == 'spot' or type == 'margin':
4997 if trigger:
4998 response = self.privateSpotGetPriceOrdersOrderId(self.extend(request, requestParams))
4999 else:
5000 response = self.privateSpotGetOrdersOrderId(self.extend(request, requestParams))
5001 elif type == 'swap':
5002 if trigger:
5003 response = self.privateFuturesGetSettlePriceOrdersOrderId(self.extend(request, requestParams))
5004 else:
5005 response = self.privateFuturesGetSettleOrdersOrderId(self.extend(request, requestParams))
5006 elif type == 'future':
5007 if trigger:
5008 response = self.privateDeliveryGetSettlePriceOrdersOrderId(self.extend(request, requestParams))
5009 else:
5010 response = self.privateDeliveryGetSettleOrdersOrderId(self.extend(request, requestParams))
5011 elif type == 'option':
5012 response = self.privateOptionsGetOrdersOrderId(self.extend(request, requestParams))
5013 else:
5014 raise NotSupported(self.id + ' fetchOrder() not support self market type')
5015 return self.parse_order(response, market)
5016
5017 def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
5018 """

Callers

nothing calls this directly

Tested by

no test coverage detected