aboutsummaryrefslogtreecommitdiff
path: root/market.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-25 23:58:32 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-25 23:58:32 +0200
commitde40b4e7d6f13ee2ed65c39ba032f03d55632684 (patch)
treee69f8f99ad47cfc3270192428fc2abee87eea65b /market.py
parentbfe841c557094afad2db0d2c63deadeea4ba63c6 (diff)
parente967a372218df05424b1566a02cafe2432d57326 (diff)
downloadTrader-de40b4e7d6f13ee2ed65c39ba032f03d55632684.tar.gz
Trader-de40b4e7d6f13ee2ed65c39ba032f03d55632684.tar.zst
Trader-de40b4e7d6f13ee2ed65c39ba032f03d55632684.zip
Merge branch 'dev'v1.0.1
Diffstat (limited to 'market.py')
-rw-r--r--market.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/market.py b/market.py
index ca65bca..d0e6ab4 100644
--- a/market.py
+++ b/market.py
@@ -1,4 +1,4 @@
1from ccxt import ExchangeError, NotSupported, RequestTimeout 1from ccxt import ExchangeError, NotSupported, RequestTimeout, InvalidNonce
2import ccxt_wrapper as ccxt 2import ccxt_wrapper as ccxt
3import time 3import time
4import psycopg2 4import psycopg2
@@ -89,7 +89,7 @@ class Market:
89 finally: 89 finally:
90 self.store_report() 90 self.store_report()
91 91
92 @retry(RequestTimeout, tries=5) 92 @retry((RequestTimeout, InvalidNonce), tries=5)
93 def move_balances(self): 93 def move_balances(self):
94 needed_in_margin = {} 94 needed_in_margin = {}
95 moving_to_margin = {} 95 moving_to_margin = {}
@@ -114,7 +114,7 @@ class Market:
114 self.ccxt.transfer_balance(currency, delta, "exchange", "margin") 114 self.ccxt.transfer_balance(currency, delta, "exchange", "margin")
115 elif delta < 0: 115 elif delta < 0:
116 self.ccxt.transfer_balance(currency, -delta, "margin", "exchange") 116 self.ccxt.transfer_balance(currency, -delta, "margin", "exchange")
117 except RequestTimeout as e: 117 except (RequestTimeout, InvalidNonce) as e:
118 self.report.log_error(action, message="Retrying", exception=e) 118 self.report.log_error(action, message="Retrying", exception=e)
119 self.report.log_move_balances(needed_in_margin, moving_to_margin) 119 self.report.log_move_balances(needed_in_margin, moving_to_margin)
120 self.balances.fetch_balances() 120 self.balances.fetch_balances()