X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=market.py;h=d0e6ab4e91f7ab4aaf654fda3cfa90497bbe3991;hb=915980607f7325b0759bd508d21aa1467a590392;hp=ca65bca7a0196211caedfa515e55b169ee71231d;hpb=337c8286cc31d81ffdad06a225996f86c46c46f0;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git 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()