From 24bf19c1fb0ea71c013f67c57a40ece585f1e426 Mon Sep 17 00:00:00 2001 From: Nelson Torres Date: Fri, 29 Nov 2024 10:41:20 -0300 Subject: [PATCH] Update api.py get_currencies function --- piker/brokers/deribit/api.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/piker/brokers/deribit/api.py b/piker/brokers/deribit/api.py index e3c52f28..86e6e0f4 100644 --- a/piker/brokers/deribit/api.py +++ b/piker/brokers/deribit/api.py @@ -319,6 +319,20 @@ class Client: return balances + async def get_currencies( + self, + + ) -> list[dict]: + ''' + Return the set of currencies for deribit. + ''' + assets = {} + resp = await self._json_rpc_auth_wrapper( + 'public/get_currencies', + params={} + ) + return resp.result + async def get_assets( self, venue: str | None = None, @@ -331,11 +345,7 @@ class Client: ''' assets = {} - resp = await self._json_rpc_auth_wrapper( - 'public/get_currencies', - params={} - ) - currencies: list[dict] = resp.result + currencies = await self.get_currencies() for currency in currencies: name: str = currency['currency'] tx_tick: Decimal = digits_to_dec(currency['fee_precision']) @@ -844,6 +854,8 @@ async def open_oi_feed( instruments: list[Symbol] async with get_client( ) as client: + # to get all currencies available in deribit + # currencies = await client.get_currencies() instruments = await client.get_instruments() fh: FeedHandler