Skip to content

Commit

Permalink
ib: i guess only discard MktPair.src: Asset on non-forex XD
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed May 23, 2023
1 parent ff74d47 commit b44b091
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions piker/brokers/ib/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b44b091

Please sign in to comment.