From 2a24d1d50cf0fbd82228c803be49ea3b88803fb7 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 21 Apr 2025 21:16:32 -0400 Subject: [PATCH] `.kraken`: add masked pauses for order req debug Such that the next time i inevitably must debug the some order-request error status or precision discrepancy, i have the mkt-symbol branch ready to go. Also, switch to `'action': 'buy'|'sell' as action,` style `case` matching instead of the post-`if` predicate style. --- piker/brokers/kraken/broker.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/piker/brokers/kraken/broker.py b/piker/brokers/kraken/broker.py index eb5963cd..bc84a230 100644 --- a/piker/brokers/kraken/broker.py +++ b/piker/brokers/kraken/broker.py @@ -175,9 +175,8 @@ async def handle_order_requests( case { 'account': 'kraken.spot' as account, - 'action': action, - } if action in {'buy', 'sell'}: - + 'action': 'buy'|'sell', + }: # validate order = BrokerdOrder(**msg) @@ -262,6 +261,12 @@ async def handle_order_requests( } | extra log.info(f'Submitting WS order request:\n{pformat(req)}') + + # NOTE HOWTO, debug order requests + # + # if 'XRP' in pair: + # await tractor.pause() + await ws.send_msg(req) # placehold for sanity checking in relay loop @@ -1085,6 +1090,8 @@ async def handle_order_updates( f'Failed to {action} order {reqid}:\n' f'{errmsg}' ) + # if tractor._state.debug_mode(): + # await tractor.pause() symbol: str = 'N/A' if chain := apiflows.get(reqid):