From f12c452d966b7f3cb29f232fef67b33bb431f51a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 18 Jun 2024 12:42:21 -0400 Subject: [PATCH] ib: warn about mkt precision cuckups that `Contract`s clearly deliver wrong.. --- piker/brokers/ib/symbols.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/piker/brokers/ib/symbols.py b/piker/brokers/ib/symbols.py index 6fe86aa9..d7c09fef 100644 --- a/piker/brokers/ib/symbols.py +++ b/piker/brokers/ib/symbols.py @@ -294,7 +294,7 @@ async def open_symbol_search(ctx: tractor.Context) -> None: elif stock_results: break # else: - await tractor.pause() + # await tractor.pause() # # match against our ad-hoc set immediately # adhoc_matches = fuzzy.extract( @@ -522,7 +522,21 @@ async def get_mkt_info( venue = con.primaryExchange or con.exchange price_tick: Decimal = Decimal(str(details.minTick)) - # price_tick: Decimal = Decimal('0.01') + ib_min_tick_gt_2: Decimal = Decimal('0.01') + if ( + price_tick < ib_min_tick_gt_2 + ): + # TODO: we need to add some kinda dynamic rounding sys + # to our MktPair i guess? + # not sure where the logic should sit, but likely inside + # the `.clearing._ems` i suppose... + log.warning( + 'IB seems to disallow a min price tick < 0.01 ' + 'when the price is > 2.0..?\n' + f'Decreasing min tick precision for {fqme} to 0.01' + ) + # price_tick = ib_min_tick + # await tractor.pause() if atype == 'stock': # XXX: GRRRR they don't support fractional share sizes for