get_mkt_info cleanup
parent
156a35b606
commit
30060a83c9
|
@ -160,38 +160,26 @@ async def get_mkt_info(
|
||||||
assets: dict[str, Asset] = await client.get_assets()
|
assets: dict[str, Asset] = await client.get_assets()
|
||||||
pair_str: str = mkt_ep.lower()
|
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(
|
pair: Pair = await client.exch_info(
|
||||||
sym=pair_str,
|
sym=pair_str,
|
||||||
)
|
)
|
||||||
dst: Asset | None = assets.get(pair.bs_dst_asset)
|
mkt_mode = pair.venue
|
||||||
if (
|
client.mkt_mode = mkt_mode
|
||||||
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())}'
|
|
||||||
)
|
|
||||||
|
|
||||||
# XXX UNKNOWN missing "asset", though no idea why?
|
dst: Asset | None = assets.get(pair.bs_dst_asset)
|
||||||
# maybe it's only avail in the margin venue(s): /dapi/ ?
|
src: Asset | None = assets.get(pair.bs_src_asset)
|
||||||
return None
|
|
||||||
|
|
||||||
mkt = MktPair(
|
mkt = MktPair(
|
||||||
dst=dst,
|
dst=dst,
|
||||||
src=assets.get(pair.bs_src_asset),
|
src=src,
|
||||||
price_tick=pair.price_tick,
|
price_tick=pair.price_tick,
|
||||||
size_tick=pair.size_tick,
|
size_tick=pair.size_tick,
|
||||||
bs_mktid=pair.symbol,
|
bs_mktid=pair.symbol,
|
||||||
expiry=expiry,
|
expiry=pair.expiry,
|
||||||
venue=venue,
|
venue=mkt_mode,
|
||||||
broker='deribit',
|
broker='deribit',
|
||||||
|
_atype=mkt_mode,
|
||||||
|
_fqme_without_src=True,
|
||||||
)
|
)
|
||||||
return mkt, pair
|
return mkt, pair
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue