name formatting fixes

deribit_fix
Nelson Torres 2024-11-15 11:23:05 -03:00
parent 30060a83c9
commit a117177759
2 changed files with 11 additions and 10 deletions

View File

@ -311,12 +311,12 @@ class Client:
atype=atype, atype=atype,
tx_tick=tx_tick) tx_tick=tx_tick)
instruments = await self.symbol_info(currency=name.lower()) instruments = await self.symbol_info(currency=name)
for instrument in instruments: for instrument in instruments:
pair = instruments[instrument] pair = instruments[instrument]
assets[pair.symbol] = Asset( assets[pair.symbol] = Asset(
name=pair.symbol, name=pair.symbol,
atype='option', atype=pair.venue,
tx_tick=pair.size_tick) tx_tick=pair.size_tick)
return assets return assets
@ -360,7 +360,7 @@ class Client:
self, self,
sym: str | None = None, sym: str | None = None,
venue: MarketType | None = None, venue: MarketType = 'option',
expiry: str | None = None, expiry: str | None = None,
) -> dict[str, Pair] | Pair: ) -> dict[str, Pair] | Pair:
@ -374,7 +374,7 @@ class Client:
return cached_pair return cached_pair
if sym: if sym:
return pair_table[sym.lower()] return pair_table[sym]
else: else:
return self._pairs return self._pairs
@ -497,7 +497,7 @@ class Client:
as_np: bool = True, as_np: bool = True,
) -> list[tuple] | np.ndarray: ) -> list[tuple] | np.ndarray:
instrument: str = mkt.bs_mktid instrument: str = mkt.bs_fqme.split('.')[0]
if end_dt is None: if end_dt is None:
end_dt = now('UTC') end_dt = now('UTC')
@ -559,7 +559,8 @@ class Client:
@acm @acm
async def get_client( async def get_client(
is_brokercheck: bool = False is_brokercheck: bool = False,
venue: MarketType = 'option',
) -> Client: ) -> Client:
async with ( async with (

View File

@ -198,7 +198,7 @@ async def stream_quotes(
# XXX: required to propagate ``tractor`` loglevel to piker logging # XXX: required to propagate ``tractor`` loglevel to piker logging
get_console_log(loglevel or tractor.current_actor().loglevel) get_console_log(loglevel or tractor.current_actor().loglevel)
sym = symbols[0] sym = symbols[0].split('.')[0]
init_msgs: list[FeedInit] = [] init_msgs: list[FeedInit] = []
@ -213,11 +213,11 @@ async def stream_quotes(
init_msgs.append( init_msgs.append(
FeedInit(mkt_info=mkt) 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: async with maybe_open_price_feed(sym) as stream:
cache = await client.cache_symbols() cache = client._pairs
last_trades = (await client.last_trades( last_trades = (await client.last_trades(
cb_sym_to_deribit_inst(nsym), count=1)).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: async with open_cached_client('deribit') as client:
# load all symbols locally for fast search # load all symbols locally for fast search
cache = await client.cache_symbols() cache = client._pairs
await ctx.started() await ctx.started()
async with ctx.open_stream() as stream: async with ctx.open_stream() as stream: