Skip to content

Commit 4710e10

Browse files
committed
kraken: handle .spot.kraken new-style FQMEs
After #520 we've moved to better supporting explicit venues for cex backends which is important where a provider offers both spot and derivatives markets (kraken, binance, kucoin) and we need to distinguish which is being traded given a common asset pair (eg. BTC/USDT). So, make this work for `kraken`'s brokerd such that requests and pre-existing live order are (un)packed to/from EMS messaging form.
1 parent 398cba0 commit 4710e10

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

piker/brokers/kraken/broker.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ async def handle_order_requests(
136136
and deliver acks or errors.
137137
138138
'''
139-
# XXX: UGH, let's unify this.. with ``msgspec``.
140-
msg: dict[str, Any]
141-
order: BrokerdOrder
142-
139+
# XXX: UGH, let's unify this.. with ``msgspec``!!!
140+
msg: dict | Order
143141
async for msg in ems_order_stream:
144142
log.info(f'Rx order msg:\n{pformat(msg)}')
145143
match msg:
@@ -227,7 +225,7 @@ async def handle_order_requests(
227225
# XXX strip any .<venue> token which should
228226
# ONLY ever be '.spot' rn, until we support
229227
# futes.
230-
bs_fqme: str = order.symbol.rstrip('.spot')
228+
bs_fqme: str = order.symbol.replace('.spot', '')
231229
psym: str = bs_fqme.upper()
232230
pair: str = f'{psym[:3]}/{psym[3:]}'
233231

@@ -891,7 +889,7 @@ async def handle_order_updates(
891889
ids.inverse.get(reqid) is None
892890
):
893891
# parse out existing live order
894-
fqme = pair.replace('/', '').lower()
892+
fqme = pair.replace('/', '').lower() + '.spot'
895893
price = float(price)
896894
size = float(vol)
897895

0 commit comments

Comments
 (0)