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

Method fetch_accounts

python/ccxt/lighter.py:1883–1934  ·  view source on GitHub ↗

fetch all the accounts associated with a profile https://apidocs.lighter.xyz/reference/account-1 :param dict [params]: extra parameters specific to the exchange API endpoint :param str [params.by]: fetch balance by 'index' or 'l1_address', defaults to 'index'

(self, params={})

Source from the content-addressed store, hash-verified

1881 })
1882
1883 def fetch_accounts(self, params={}) -> List[Account]:
1884 """
1885 fetch all the accounts associated with a profile
1886
1887 https://apidocs.lighter.xyz/reference/account-1
1888
1889 :param dict [params]: extra parameters specific to the exchange API endpoint
1890 :param str [params.by]: fetch balance by 'index' or 'l1_address', defaults to 'index'
1891 :param str [params.value]: fetch balance value, account index or l1 address
1892 :returns dict: a dictionary of `account structures <https://docs.ccxt.com/?id=accounts-structure>` indexed by the account type
1893 """
1894 self.load_markets()
1895 accountIndex = None
1896 accountIndex, params = self.handle_account_index(params, 'fetchAccounts', 'accountIndex', 'account_index')
1897 request = {
1898 'by': self.safe_string(params, 'by', 'index'),
1899 'value': accountIndex,
1900 }
1901 response = self.publicGetAccount(self.extend(request, params))
1902 #
1903 # {
1904 # "code": "200",
1905 # "total": "1",
1906 # "accounts": [
1907 # {
1908 # "code": "0",
1909 # "account_type": "0",
1910 # "index": "1077",
1911 # "l1_address": "0x15f43D1f2DeE81424aFd891943262aa90F22cc2A",
1912 # "cancel_all_time": "0",
1913 # "total_order_count": "1",
1914 # "total_isolated_order_count": "0",
1915 # "pending_order_count": "0",
1916 # "available_balance": "7996.489834",
1917 # "status": "1",
1918 # "collateral": "9000.000000",
1919 # "account_index": "1077",
1920 # "name": "",
1921 # "description": "",
1922 # "can_invite": True,
1923 # "referral_points_percentage": "",
1924 # "positions": [],
1925 # "assets": [],
1926 # "total_asset_value": "9536.789088",
1927 # "cross_asset_value": "9536.789088",
1928 # "shares": []
1929 # }
1930 # ]
1931 # }
1932 #
1933 accounts = self.safe_list(response, 'accounts', [])
1934 return self.parse_accounts(accounts, params)
1935
1936 def parse_account(self, account):
1937 #

Callers

nothing calls this directly

Calls 7

handle_account_indexMethod · 0.95
safe_stringMethod · 0.80
safe_listMethod · 0.80
parse_accountsMethod · 0.80
publicGetAccountMethod · 0.65
load_marketsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected