diff --git a/piker/brokers/binance/feed.py b/piker/brokers/binance/feed.py index 53a5073d..48905a35 100644 --- a/piker/brokers/binance/feed.py +++ b/piker/brokers/binance/feed.py @@ -237,8 +237,8 @@ async def open_history_client( async def get_ohlc( timeframe: float, - end_dt: datetime | None = None, - start_dt: datetime | None = None, + end_dt: datetime|None = None, + start_dt: datetime|None = None, ) -> tuple[ np.ndarray, @@ -277,7 +277,11 @@ async def open_history_client( if end_dt is None: inow: int = round(time.time()) - if (inow - times[-1]) > 60: + if ( + (inow - times[-1]) + > + timeframe + ): await tractor.pause() start_dt = from_timestamp(times[0]) @@ -291,7 +295,7 @@ async def open_history_client( async def get_mkt_info( fqme: str, -) -> tuple[MktPair, Pair] | None: +) -> tuple[MktPair, Pair]|None: # uppercase since kraken bs_mktid is always upper if 'binance' not in fqme.lower(): @@ -368,7 +372,7 @@ async def get_mkt_info( if 'futes' in mkt_mode: assert isinstance(pair, FutesPair) - dst: Asset | None = assets.get(pair.bs_dst_asset) + dst: Asset|None = assets.get(pair.bs_dst_asset) if ( not dst # TODO: a known asset DNE list? @@ -427,7 +431,7 @@ async def subscribe( # might get ack from ws server, or maybe some # other msg still in transit.. res = await ws.recv_msg() - subid: str | None = res.get('id') + subid: str|None = res.get('id') if subid: assert res['id'] == subid diff --git a/piker/brokers/ib/symbols.py b/piker/brokers/ib/symbols.py index 04ec74e4..13d834ff 100644 --- a/piker/brokers/ib/symbols.py +++ b/piker/brokers/ib/symbols.py @@ -134,7 +134,7 @@ _adhoc_fiat_set = set(( # manually discovered tick discrepancies, # onl god knows how or why they'd cuck these up.. -_adhoc_mkt_infos: dict[int | str, dict] = { +_adhoc_mkt_infos: dict[int|str, dict] = { 'vtgn.nasdaq': {'price_tick': Decimal('0.01')}, } @@ -488,8 +488,7 @@ def con2fqme( @async_lifo_cache() async def get_mkt_info( fqme: str, - - proxy: MethodProxy | None = None, + proxy: MethodProxy|None = None, ) -> tuple[MktPair, ibis.ContractDetails]: @@ -550,7 +549,7 @@ async def get_mkt_info( size_tick: Decimal = Decimal( str(details.minSize).rstrip('0') ) - # |-> TODO: there is also the Contract.sizeIncrement, bt wtf is it? + # ?TODO, there is also the Contract.sizeIncrement, bt wtf is it? # NOTE: this is duplicate from the .broker.norm_trade_records() # routine, we should factor all this parsing somewhere..