From b47d7b54cca8ff142eaadf38c8bb425bf11af2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 25 Mar 2018 23:57:39 +0200 Subject: Handle invalid nonces --- market.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'market.py') diff --git a/market.py b/market.py index ca65bca..d0e6ab4 100644 --- a/market.py +++ b/market.py @@ -1,4 +1,4 @@ -from ccxt import ExchangeError, NotSupported, RequestTimeout +from ccxt import ExchangeError, NotSupported, RequestTimeout, InvalidNonce import ccxt_wrapper as ccxt import time import psycopg2 @@ -89,7 +89,7 @@ class Market: finally: self.store_report() - @retry(RequestTimeout, tries=5) + @retry((RequestTimeout, InvalidNonce), tries=5) def move_balances(self): needed_in_margin = {} moving_to_margin = {} @@ -114,7 +114,7 @@ class Market: self.ccxt.transfer_balance(currency, delta, "exchange", "margin") elif delta < 0: self.ccxt.transfer_balance(currency, -delta, "margin", "exchange") - except RequestTimeout as e: + except (RequestTimeout, InvalidNonce) as e: self.report.log_error(action, message="Retrying", exception=e) self.report.log_move_balances(needed_in_margin, moving_to_margin) self.balances.fetch_balances() -- cgit v1.2.3