Adjust type annots in binance and IB symbol mods

Namely, again switching `|`-union syntax to rm adjacent white space.

Also, flip to multiline style for threshold comparison in
`.binance.feed` and change gap-check threshold to `timeframe` (vs
a hardcoded `60`s) in the `get_ohlc()` closure.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
fix_tractor_logging
Gud Boi 2026-02-06 10:14:36 -05:00
parent ce1f038b53
commit 7ff1fa5369
2 changed files with 13 additions and 10 deletions

View File

@ -237,8 +237,8 @@ async def open_history_client(
async def get_ohlc( async def get_ohlc(
timeframe: float, timeframe: float,
end_dt: datetime | None = None, end_dt: datetime|None = None,
start_dt: datetime | None = None, start_dt: datetime|None = None,
) -> tuple[ ) -> tuple[
np.ndarray, np.ndarray,
@ -277,7 +277,11 @@ async def open_history_client(
if end_dt is None: if end_dt is None:
inow: int = round(time.time()) inow: int = round(time.time())
if (inow - times[-1]) > 60: if (
(inow - times[-1])
>
timeframe
):
await tractor.pause() await tractor.pause()
start_dt = from_timestamp(times[0]) start_dt = from_timestamp(times[0])
@ -291,7 +295,7 @@ async def open_history_client(
async def get_mkt_info( async def get_mkt_info(
fqme: str, fqme: str,
) -> tuple[MktPair, Pair] | None: ) -> tuple[MktPair, Pair]|None:
# uppercase since kraken bs_mktid is always upper # uppercase since kraken bs_mktid is always upper
if 'binance' not in fqme.lower(): if 'binance' not in fqme.lower():
@ -368,7 +372,7 @@ async def get_mkt_info(
if 'futes' in mkt_mode: if 'futes' in mkt_mode:
assert isinstance(pair, FutesPair) assert isinstance(pair, FutesPair)
dst: Asset | None = assets.get(pair.bs_dst_asset) dst: Asset|None = assets.get(pair.bs_dst_asset)
if ( if (
not dst not dst
# TODO: a known asset DNE list? # TODO: a known asset DNE list?
@ -427,7 +431,7 @@ async def subscribe(
# might get ack from ws server, or maybe some # might get ack from ws server, or maybe some
# other msg still in transit.. # other msg still in transit..
res = await ws.recv_msg() res = await ws.recv_msg()
subid: str | None = res.get('id') subid: str|None = res.get('id')
if subid: if subid:
assert res['id'] == subid assert res['id'] == subid

View File

@ -134,7 +134,7 @@ _adhoc_fiat_set = set((
# manually discovered tick discrepancies, # manually discovered tick discrepancies,
# onl god knows how or why they'd cuck these up.. # 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')}, 'vtgn.nasdaq': {'price_tick': Decimal('0.01')},
} }
@ -488,8 +488,7 @@ def con2fqme(
@async_lifo_cache() @async_lifo_cache()
async def get_mkt_info( async def get_mkt_info(
fqme: str, fqme: str,
proxy: MethodProxy|None = None,
proxy: MethodProxy | None = None,
) -> tuple[MktPair, ibis.ContractDetails]: ) -> tuple[MktPair, ibis.ContractDetails]:
@ -550,7 +549,7 @@ async def get_mkt_info(
size_tick: Decimal = Decimal( size_tick: Decimal = Decimal(
str(details.minSize).rstrip('0') 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() # NOTE: this is duplicate from the .broker.norm_trade_records()
# routine, we should factor all this parsing somewhere.. # routine, we should factor all this parsing somewhere..