From b39affc96e23627577239c2298c42fae16017da2 Mon Sep 17 00:00:00 2001 From: Nelson Torres Date: Fri, 8 Nov 2024 21:42:42 +0000 Subject: [PATCH] created exch_info in api class --- piker/brokers/deribit/api.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/piker/brokers/deribit/api.py b/piker/brokers/deribit/api.py index 6f8f659d..235a49d3 100644 --- a/piker/brokers/deribit/api.py +++ b/piker/brokers/deribit/api.py @@ -344,6 +344,28 @@ class Client: 'private/cancel', {'order_id': oid}) return resp.result + async def exch_info( + self, + sym: str | None = None, + + venue: MarketType | None = None, + expiry: str | None = None, + + ) -> dict[str, Pair] | Pair: + + pair_table: dict[str, Pair] = self._pairs + + if ( + sym + and (cached_pair := pair_table.get(sym)) + ): + return cached_pair + + if sym: + return pair_table[sym.lower()] + else: + return self._pairs + async def symbol_info( self, instrument: Optional[str] = None,