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

Method fetch_closed_orders

python/ccxt/ascendex.py:2101–2263  ·  view source on GitHub ↗

fetches information on multiple closed orders made by the user https://ascendex.github.io/ascendex-pro-api/#list-history-orders-v2 https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-current-history-orders :param str symbol: unified market symbol of the ma

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

Source from the content-addressed store, hash-verified

2099 return self.filter_by_symbol_since_limit(orders, symbol, since, limit)
2100
2101 def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2102 """
2103 fetches information on multiple closed orders made by the user
2104
2105 https://ascendex.github.io/ascendex-pro-api/#list-history-orders-v2
2106 https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-current-history-orders
2107
2108 :param str symbol: unified market symbol of the market orders were made in
2109 :param int [since]: the earliest time in ms to fetch orders for
2110 :param int [limit]: the maximum number of order structures to retrieve
2111 :param dict [params]: extra parameters specific to the exchange API endpoint
2112 :param int [params.until]: the latest time in ms to fetch orders for
2113 :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
2114 """
2115 self.load_markets()
2116 self.load_accounts()
2117 account = self.safe_dict(self.accounts, 0, {})
2118 accountGroup = self.safe_string(account, 'id')
2119 request = {
2120 # 'category': accountCategory,
2121 # 'symbol': market['id'],
2122 # 'orderType': 'market', # optional, string
2123 # 'side': 'buy', # or 'sell', optional, case insensitive.
2124 # 'status': 'Filled', # "Filled", "Canceled", or "Rejected"
2125 # 'startTime': exchange.milliseconds(),
2126 # 'endTime': exchange.milliseconds(),
2127 # 'page': 1,
2128 # 'pageSize': 100,
2129 }
2130 market = None
2131 if symbol is not None:
2132 market = self.market(symbol)
2133 request['symbol'] = market['id']
2134 type, query = self.handle_market_type_and_params('fetchClosedOrders', market, params)
2135 options = self.safe_dict(self.options, 'fetchClosedOrders', {})
2136 defaultMethod = self.safe_string(options, 'method', 'v2PrivateDataGetOrderHist')
2137 method = self.get_supported_mapping(type, {
2138 'spot': defaultMethod,
2139 'margin': defaultMethod,
2140 'swap': 'v2PrivateAccountGroupGetFuturesOrderHistCurrent',
2141 })
2142 if since is not None:
2143 request['startTime'] = since
2144 until = self.safe_string(params, 'until')
2145 if until is not None:
2146 request['endTime'] = until
2147 accountsByType = self.safe_dict(self.options, 'accountsByType', {})
2148 accountCategory = self.safe_string(accountsByType, type, 'cash') # margin, futures
2149 response = None
2150 if method == 'v1PrivateAccountCategoryGetOrderHistCurrent':
2151 request['account-group'] = accountGroup
2152 request['account-category'] = accountCategory
2153 if limit is not None:
2154 request['limit'] = limit
2155 response = self.v1PrivateAccountCategoryGetOrderHistCurrent(self.extend(request, query))
2156 elif method == 'v2PrivateDataGetOrderHist':
2157 request['account'] = accountCategory
2158 if limit is not None:

Callers

nothing calls this directly

Calls 14

NotSupportedClass · 0.90
safe_dictMethod · 0.80
safe_stringMethod · 0.80
get_supported_mappingMethod · 0.80
safe_listMethod · 0.80
parse_ordersMethod · 0.80
load_marketsMethod · 0.45
load_accountsMethod · 0.45
marketMethod · 0.45

Tested by

no test coverage detected