From 30060a83c9d30d8cfb039ccc675bb3c84ea83e49 Mon Sep 17 00:00:00 2001 From: Nelson Torres Date: Fri, 15 Nov 2024 11:22:27 -0300 Subject: [PATCH] get_mkt_info cleanup --- piker/brokers/deribit/feed.py | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/piker/brokers/deribit/feed.py b/piker/brokers/deribit/feed.py index 5c85e09d..9a02985f 100644 --- a/piker/brokers/deribit/feed.py +++ b/piker/brokers/deribit/feed.py @@ -160,38 +160,26 @@ async def get_mkt_info( assets: dict[str, Asset] = await client.get_assets() pair_str: str = mkt_ep.lower() - # switch venue-mode depending on input pattern parsing - # since we want to use a particular endpoint (set) for - # pair info lookup! - client.mkt_mode = mkt_mode - pair: Pair = await client.exch_info( sym=pair_str, ) - dst: Asset | None = assets.get(pair.bs_dst_asset) - if ( - not dst - # TODO: a known asset DNE list? - # and pair.baseAsset == 'DEFI' - ): - log.warning( - f'UNKNOWN {venue} asset {pair.base_currency} from,\n' - f'{pformat(pair.to_dict())}' - ) + mkt_mode = pair.venue + client.mkt_mode = mkt_mode - # XXX UNKNOWN missing "asset", though no idea why? - # maybe it's only avail in the margin venue(s): /dapi/ ? - return None + dst: Asset | None = assets.get(pair.bs_dst_asset) + src: Asset | None = assets.get(pair.bs_src_asset) mkt = MktPair( dst=dst, - src=assets.get(pair.bs_src_asset), + src=src, price_tick=pair.price_tick, size_tick=pair.size_tick, bs_mktid=pair.symbol, - expiry=expiry, - venue=venue, + expiry=pair.expiry, + venue=mkt_mode, broker='deribit', + _atype=mkt_mode, + _fqme_without_src=True, ) return mkt, pair