get_assets refactor
parent
b25a7699ab
commit
71f3a0a4cd
|
@ -302,20 +302,32 @@ class Client:
|
|||
|
||||
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
|
||||
by symbol.
|
||||
"""
|
||||
balances = {}
|
||||
assets = {}
|
||||
resp = await self.json_rpc(
|
||||
'private/get_account_summaries',
|
||||
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
|
||||
|
||||
for currency in self.currencies:
|
||||
resp = await self.json_rpc(
|
||||
'private/get_account_summary', params={
|
||||
'currency': currency.upper()})
|
||||
|
||||
balances[currency] = resp.result['balance']
|
||||
|
||||
return balances
|
||||
|
||||
async def submit_limit(
|
||||
self,
|
||||
|
|
Loading…
Reference in New Issue