diff --git a/piker/brokers/binance/feed.py b/piker/brokers/binance/feed.py index b1dcda85..22500f9c 100644 --- a/piker/brokers/binance/feed.py +++ b/piker/brokers/binance/feed.py @@ -203,9 +203,13 @@ async def stream_messages( yield 'trade', piker_quote -def make_sub(pairs: list[str], sub_name: str, uid: int) -> dict[str, str]: +def make_sub( + pairs: list[str], + sub_name: str, + uid: int, +) -> dict[str, str]: ''' - Create a request subscription packet dict. + Create a request subscription packet `dict`. - spot: https://binance-docs.github.io/apidocs/spot/en/#live-subscribing-unsubscribing-to-streams @@ -332,7 +336,8 @@ async def get_mkt_info( # TODO: handle coinm futes which have a margin asset that # is some crypto token! # https://binance-docs.github.io/apidocs/delivery/en/#exchange-information - or 'btc' in venue_lower + or + 'btc' in venue_lower ): return None @@ -343,12 +348,14 @@ async def get_mkt_info( if ( venue - and 'spot' not in venue_lower + and + 'spot' not in venue_lower # XXX: catch all in case user doesn't know which # venue they want (usdtm vs. coinm) and we can choose # a default (via config?) once we support coin-m APIs. - or 'perp' in venue_lower + or + 'perp' in venue_lower ): if not mkt_mode: mkt_mode: str = f'{venue_lower}_futes' diff --git a/piker/tsp/_history.py b/piker/tsp/_history.py index aa332fec..19380c71 100644 --- a/piker/tsp/_history.py +++ b/piker/tsp/_history.py @@ -739,12 +739,21 @@ async def start_backfill( # including the dst[/src] source asset token. SO, # 'tsla.nasdaq.ib' over 'tsla/usd.nasdaq.ib' for # historical reasons ONLY. - if mkt.dst.atype not in { - 'crypto', - 'crypto_currency', - 'fiat', # a "forex pair" - 'perpetual_future', # stupid "perps" from cex land - }: + if ( + mkt.dst.atype not in { + 'crypto', + 'crypto_currency', + 'fiat', # a "forex pair" + 'perpetual_future', # stupid "perps" from cex land + } + and not ( + mkt.src.atype == 'crypto_currency' + and + mkt.dst.atype in { + 'future', + } + ) + ): col_sym_key: str = mkt.get_fqme( delim_char='', without_src=True,