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

Method fetch_closed_orders

python/ccxt/lighter.py:2044–2119  ·  view source on GitHub ↗

fetch all unfilled currently closed orders https://apidocs.lighter.xyz/reference/accountinactiveorders :param str symbol: unified market symbol :param int [since]: the earliest time in ms to fetch open orders for :param int [limit]: the maximum number of op

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

Source from the content-addressed store, hash-verified

2042 return self.parse_orders(data, market, since, limit)
2043
2044 def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
2045 """
2046 fetch all unfilled currently closed orders
2047
2048 https://apidocs.lighter.xyz/reference/accountinactiveorders
2049
2050 :param str symbol: unified market symbol
2051 :param int [since]: the earliest time in ms to fetch open orders for
2052 :param int [limit]: the maximum number of open orders structures to retrieve
2053 :param dict [params]: extra parameters specific to the exchange API endpoint
2054 :param str [params.accountIndex]: account index
2055 :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
2056 """
2057 if symbol is None:
2058 raise ArgumentsRequired(self.id + ' fetchClosedOrders() requires a symbol argument')
2059 self.load_markets()
2060 accountIndex = None
2061 accountIndex, params = self.handle_account_index(params, 'fetchClosedOrders', 'accountIndex', 'account_index')
2062 apiKeyIndex = None
2063 apiKeyIndex, params = self.handle_api_key_index(params, 'fetchClosedOrders', 'apiKeyIndex', 'api_key_index')
2064 strAccountIndex = self.number_to_string(accountIndex)
2065 strApiKeyIndex = self.number_to_string(apiKeyIndex)
2066 self.load_account(self.options['chainId'], self.get_lighter_private_key(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params)
2067 market = self.market(symbol)
2068 request = {
2069 'market_id': market['id'],
2070 'account_index': accountIndex,
2071 'limit': 100, # required, max 100
2072 }
2073 if limit is not None:
2074 request['limit'] = min(limit, 100)
2075 response = self.privateGetAccountInactiveOrders(self.extend(request, params))
2076 #
2077 # {
2078 # "code": 200,
2079 # "orders": [
2080 # {
2081 # "order_index": 281474977354074,
2082 # "client_order_index": 0,
2083 # "order_id": "281474977354074",
2084 # "client_order_id": "0",
2085 # "market_index": 0,
2086 # "owner_account_index": 1077,
2087 # "initial_base_amount": "36.0386",
2088 # "price": "2221.60",
2089 # "nonce": 643418,
2090 # "remaining_base_amount": "0.0000",
2091 # "is_ask": True,
2092 # "base_size": 0,
2093 # "base_price": 222160,
2094 # "filled_base_amount": "0.0000",
2095 # "filled_quote_amount": "0.000000",
2096 # "side": "",
2097 # "type": "market",
2098 # "time_in_force": "immediate-or-cancel",
2099 # "reduce_only": False,
2100 # "trigger_price": "0.00",
2101 # "order_expiry": 0,

Callers

nothing calls this directly

Calls 11

handle_account_indexMethod · 0.95
handle_api_key_indexMethod · 0.95
load_accountMethod · 0.95
ArgumentsRequiredClass · 0.90
safe_listMethod · 0.80
parse_ordersMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected