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

Method fetch_open_orders

python/ccxt/lighter.py:1970–2042  ·  view source on GitHub ↗

fetch all unfilled currently open orders https://apidocs.lighter.xyz/reference/accountactiveorders :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 open o

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

Source from the content-addressed store, hash-verified

1968 }
1969
1970 def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1971 """
1972 fetch all unfilled currently open orders
1973
1974 https://apidocs.lighter.xyz/reference/accountactiveorders
1975
1976 :param str symbol: unified market symbol
1977 :param int [since]: the earliest time in ms to fetch open orders for
1978 :param int [limit]: the maximum number of open orders structures to retrieve
1979 :param dict [params]: extra parameters specific to the exchange API endpoint
1980 :param str [params.accountIndex]: account index
1981 :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
1982 """
1983 if symbol is None:
1984 raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a symbol argument')
1985 self.load_markets()
1986 accountIndex = None
1987 accountIndex, params = self.handle_account_index(params, 'fetchOpenOrders', 'accountIndex', 'account_index')
1988 apiKeyIndex = None
1989 apiKeyIndex, params = self.handle_api_key_index(params, 'fetchOpenOrders', 'apiKeyIndex', 'api_key_index')
1990 strAccountIndex = self.number_to_string(accountIndex)
1991 strApiKeyIndex = self.number_to_string(apiKeyIndex)
1992 self.load_account(self.options['chainId'], self.get_lighter_private_key(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params)
1993 market = self.market(symbol)
1994 request = {
1995 'market_id': market['id'],
1996 'account_index': accountIndex,
1997 }
1998 response = self.privateGetAccountActiveOrders(self.extend(request, params))
1999 #
2000 # {
2001 # "code": 200,
2002 # "orders": [
2003 # {
2004 # "order_index": 281474977354074,
2005 # "client_order_index": 0,
2006 # "order_id": "281474977354074",
2007 # "client_order_id": "0",
2008 # "market_index": 0,
2009 # "owner_account_index": 1077,
2010 # "initial_base_amount": "36.0386",
2011 # "price": "2221.60",
2012 # "nonce": 643418,
2013 # "remaining_base_amount": "0.0000",
2014 # "is_ask": True,
2015 # "base_size": 0,
2016 # "base_price": 222160,
2017 # "filled_base_amount": "0.0000",
2018 # "filled_quote_amount": "0.000000",
2019 # "side": "",
2020 # "type": "market",
2021 # "time_in_force": "immediate-or-cancel",
2022 # "reduce_only": False,
2023 # "trigger_price": "0.00",
2024 # "order_expiry": 0,
2025 # "status": "canceled-margin-not-allowed",
2026 # "trigger_status": "na",
2027 # "trigger_time": 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