From 94290c7d8bc59fa4ceaeb50c13c59b8b469ebd83 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 12 Jan 2023 15:59:37 -0500 Subject: [PATCH] `kraken`: ignore mismatched zero-ed pps (for now) See more details in the GH comment: https://github.com/pikers/piker/issues/373#issuecomment-1380988581 More or less we need to pull and include the transfer fees for withdrawals in our ledger tracking but this serves as a sloppy workaround for the moment. --- piker/brokers/kraken/broker.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/piker/brokers/kraken/broker.py b/piker/brokers/kraken/broker.py index bd992c95..6432ee57 100644 --- a/piker/brokers/kraken/broker.py +++ b/piker/brokers/kraken/broker.py @@ -534,6 +534,21 @@ async def trades_dialogue( ): return pp + elif ( + size == 0 + and pp.size + ): + log.warning( + f'`kraken` account says you have a ZERO ' + f'balance for {bsuid}:{pair}\n' + f'but piker seems to think `{pp.size}`\n' + 'This is likely a discrepancy in piker ' + 'accounting if the above number is' + "large,' though it's likely to due lack" + "f tracking xfers fees.." + ) + return pp + return False pos = has_pp(dst, size) @@ -590,7 +605,7 @@ async def trades_dialogue( f'{pformat(updated)}' ) - if not has_pp(dst, size): + if has_pp(dst, size): raise ValueError( 'Could not reproduce balance:\n' f'dst: {dst}, {size}\n'