From b44b0915ca81ca5c37c99126c3a715ed2e88c5c6 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 23 May 2023 19:11:40 -0400 Subject: [PATCH] ib: i guess only discard `MktPair.src: Asset` on non-forex XD --- piker/brokers/ib/feed.py | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/piker/brokers/ib/feed.py b/piker/brokers/ib/feed.py index b13e963a..3a7728d2 100644 --- a/piker/brokers/ib/feed.py +++ b/piker/brokers/ib/feed.py @@ -146,7 +146,18 @@ async def open_history_client( mkt.src and mkt.src.atype == 'fiat' ): - fqme: str = mkt.get_bs_fqme(without_src=True) + fqme_kwargs: dict[str, Any] = {} + + if mkt.dst.atype == 'forex': + + # XXX: for now we do need the src token kept in since + fqme_kwargs = { + 'without_src': False, # default is True + 'delim_char': '', # bc they would normally use a frickin `.` smh + } + + fqme: str = mkt.get_bs_fqme(**(fqme_kwargs)) + else: fqme = mkt.bs_fqme @@ -812,24 +823,26 @@ async def get_mkt_info( # str(expiry).strip(' ') # )) + # TODO: currently we can't pass the fiat src asset because + # then we'll get a `MNQUSD` request for history data.. + # we need to figure out how we're going to handle this (later?) + # but likely we want all backends to eventually handle + # ``dst/src.venue.`` style !? + src: str | Asset = '' + if atype == 'forex': + src = Asset( + name=str(con.currency), + atype='fiat', + tx_tick=Decimal('0.01'), # right? + ) + mkt = MktPair( dst=Asset( name=con.symbol.lower(), atype=atype, tx_tick=size_tick, ), - - # TODO: currently we can't pass the fiat src asset because - # then we'll get a `MNQUSD` request for history data.. - # we need to figure out how we're going to handle this (later?) - # but likely we want all backends to eventually handle - # ``dst/src.venue.`` style !? - - # src=Asset( - # name=str(con.currency), - # atype='fiat', - # tx_tick=Decimal('0.01'), # right? - # ), + src=src, price_tick=price_tick, size_tick=size_tick,