get_assets refactor

jsonrpc_err_in_rent_task
Nelson Torres 2024-11-08 21:46:58 +00:00
parent b25a7699ab
commit 71f3a0a4cd
1 changed files with 22 additions and 10 deletions

View File

@ -302,20 +302,32 @@ class Client:
return balances return balances
async def get_assets(self) -> dict[str, float]: async def get_assets(
self,
venue: str | None = None,
) -> dict[str, Asset]:
"""Return the set of asset balances for this account """Return the set of asset balances for this account
by symbol. by symbol.
""" """
balances = {} assets = {}
for currency in self.currencies:
resp = await self.json_rpc( resp = await self.json_rpc(
'private/get_account_summary', params={ 'private/get_account_summaries',
'currency': currency.upper()}) params={
'extended' : True
}
)
summaries = resp.result['summaries']
for summary in summaries:
currency = summary['currency']
tx_tick = Decimal('1e-08')
atype='crypto_currency'
assets[currency] = Asset(
name=currency,
atype=atype,
tx_tick=tx_tick)
return assets
balances[currency] = resp.result['balance']
return balances
async def submit_limit( async def submit_limit(
self, self,