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

Method fetch_closed_orders

python/ccxt/gate.py:5035–5083  ·  view source on GitHub ↗

fetches information on multiple closed orders made by the user https://www.gate.com/en-eu/docs/developers/apiv4/#list-orders https://www.gate.com/en-eu/docs/developers/apiv4/#retrieve-running-auto-order-list https://www.gate.com/docs/developers/apiv4/en/#query-futur

(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

5033 return self.fetch_orders_by_status('open', symbol, since, limit, params)
5034
5035 def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
5036 """
5037 fetches information on multiple closed orders made by the user
5038
5039 https://www.gate.com/en-eu/docs/developers/apiv4/#list-orders
5040 https://www.gate.com/en-eu/docs/developers/apiv4/#retrieve-running-auto-order-list
5041 https://www.gate.com/docs/developers/apiv4/en/#query-futures-order-list
5042 https://www.gate.com/docs/developers/apiv4/en/#query-auto-order-list
5043 https://www.gate.com/docs/developers/apiv4/en/#query-futures-order-list-2
5044 https://www.gate.com/docs/developers/apiv4/en/#query-auto-order-list-2
5045 https://www.gate.com/docs/developers/apiv4/en/#list-options-orders
5046 https://www.gate.com/docs/developers/apiv4/en/#query-futures-order-list-by-time-range
5047
5048 :param str symbol: unified market symbol of the market orders were made in
5049 :param int [since]: the earliest time in ms to fetch orders for
5050 :param int [limit]: the maximum number of order structures to retrieve
5051 :param dict [params]: extra parameters specific to the exchange API endpoint
5052 :param bool [params.trigger]: True for fetching trigger orders
5053 :param str [params.type]: spot, swap or future, if not provided self.options['defaultType'] is used
5054 :param str [params.marginMode]: 'cross' or 'isolated' - marginMode for margin trading if not provided self.options['defaultMarginMode'] is used
5055 :param boolean [params.historical]: *swap only* True for using historical endpoint
5056 :param bool [params.unifiedAccount]: set to True for fetching unified account orders
5057 :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
5058 """
5059 self.load_markets()
5060 self.load_unified_status()
5061 until = self.safe_integer(params, 'until')
5062 market = None
5063 if symbol is not None:
5064 market = self.market(symbol)
5065 symbol = market['symbol']
5066 res = self.handle_market_type_and_params('fetchClosedOrders', market, params)
5067 type = self.safe_string(res, 0)
5068 useHistorical = False
5069 useHistorical, params = self.handle_option_and_params(params, 'fetchClosedOrders', 'historical', False)
5070 if not useHistorical and ((since is None and until is None) or (type != 'swap')):
5071 return self.fetch_orders_by_status('finished', symbol, since, limit, params)
5072 params = self.omit(params, 'type')
5073 request = {}
5074 request, params = self.prepare_request(market, type, params)
5075 if since is not None:
5076 request['from'] = self.parse_to_int(since / 1000)
5077 if until is not None:
5078 params = self.omit(params, 'until')
5079 request['to'] = self.parse_to_int(until / 1000)
5080 if limit is not None:
5081 request['limit'] = limit
5082 response = self.privateFuturesGetSettleOrdersTimerange(self.extend(request, params))
5083 return self.parse_orders(response, market, since, limit)
5084
5085 def prepare_orders_by_status_request(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5086 market = None

Callers

nothing calls this directly

Calls 14

load_unified_statusMethod · 0.95
prepare_requestMethod · 0.95
safe_integerMethod · 0.80
safe_stringMethod · 0.80
parse_to_intMethod · 0.80
parse_ordersMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45

Tested by

no test coverage detected