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(
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

View File

@ -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..