From 5304a36b8758da20c790043c5501626d305bb6c6 Mon Sep 17 00:00:00 2001 From: Nelson Torres Date: Wed, 13 Nov 2024 10:43:30 -0300 Subject: [PATCH] get_assets now uses public endpoint It's better if the data is available through a public endpoint. --- piker/brokers/deribit/api.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/piker/brokers/deribit/api.py b/piker/brokers/deribit/api.py index ae5e35a6..1e17868e 100644 --- a/piker/brokers/deribit/api.py +++ b/piker/brokers/deribit/api.py @@ -65,6 +65,7 @@ from .venues import ( ) from piker.accounting import ( Asset, + digits_to_dec, MktPair, ) from piker.data import ( @@ -308,18 +309,16 @@ class Client: """ assets = {} resp = await self.json_rpc( - 'private/get_account_summaries', - params={ - 'extended' : True - } + 'public/get_currencies', + params={} ) - summaries = resp.result['summaries'] - for summary in summaries: - currency = summary['currency'] - tx_tick = Decimal('1e-08') + currencies = resp.result + for currency in currencies: + name = currency['currency'] + tx_tick = digits_to_dec(currency['fee_precision']) atype='crypto_currency' - assets[currency] = Asset( - name=currency, + assets[name] = Asset( + name=name, atype=atype, tx_tick=tx_tick) return assets @@ -461,7 +460,6 @@ class Client: limit=limit ) - async def bars( self, mkt: MktPair,