From a117177759faf5af3475956d01c9c8cfa1d0114d Mon Sep 17 00:00:00 2001 From: Nelson Torres Date: Fri, 15 Nov 2024 11:23:05 -0300 Subject: [PATCH] name formatting fixes --- piker/brokers/deribit/api.py | 13 +++++++------ piker/brokers/deribit/feed.py | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/piker/brokers/deribit/api.py b/piker/brokers/deribit/api.py index 5aa8f208..b8c20b23 100644 --- a/piker/brokers/deribit/api.py +++ b/piker/brokers/deribit/api.py @@ -311,12 +311,12 @@ class Client: atype=atype, tx_tick=tx_tick) - instruments = await self.symbol_info(currency=name.lower()) + instruments = await self.symbol_info(currency=name) for instrument in instruments: pair = instruments[instrument] assets[pair.symbol] = Asset( name=pair.symbol, - atype='option', + atype=pair.venue, tx_tick=pair.size_tick) return assets @@ -360,7 +360,7 @@ class Client: self, sym: str | None = None, - venue: MarketType | None = None, + venue: MarketType = 'option', expiry: str | None = None, ) -> dict[str, Pair] | Pair: @@ -374,7 +374,7 @@ class Client: return cached_pair if sym: - return pair_table[sym.lower()] + return pair_table[sym] else: return self._pairs @@ -497,7 +497,7 @@ class Client: as_np: bool = True, ) -> list[tuple] | np.ndarray: - instrument: str = mkt.bs_mktid + instrument: str = mkt.bs_fqme.split('.')[0] if end_dt is None: end_dt = now('UTC') @@ -559,7 +559,8 @@ class Client: @acm async def get_client( - is_brokercheck: bool = False + is_brokercheck: bool = False, + venue: MarketType = 'option', ) -> Client: async with ( diff --git a/piker/brokers/deribit/feed.py b/piker/brokers/deribit/feed.py index 9a02985f..e32e31d2 100644 --- a/piker/brokers/deribit/feed.py +++ b/piker/brokers/deribit/feed.py @@ -198,7 +198,7 @@ async def stream_quotes( # XXX: required to propagate ``tractor`` loglevel to piker logging get_console_log(loglevel or tractor.current_actor().loglevel) - sym = symbols[0] + sym = symbols[0].split('.')[0] init_msgs: list[FeedInit] = [] @@ -213,11 +213,11 @@ async def stream_quotes( init_msgs.append( FeedInit(mkt_info=mkt) ) - nsym = piker_sym_to_cb_sym(sym.split('.')[0]) + nsym = piker_sym_to_cb_sym(sym) async with maybe_open_price_feed(sym) as stream: - cache = await client.cache_symbols() + cache = client._pairs last_trades = (await client.last_trades( cb_sym_to_deribit_inst(nsym), count=1)).trades @@ -259,7 +259,7 @@ async def open_symbol_search( async with open_cached_client('deribit') as client: # load all symbols locally for fast search - cache = await client.cache_symbols() + cache = client._pairs await ctx.started() async with ctx.open_stream() as stream: