diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-25 23:58:32 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-25 23:58:32 +0200 |
commit | de40b4e7d6f13ee2ed65c39ba032f03d55632684 (patch) | |
tree | e69f8f99ad47cfc3270192428fc2abee87eea65b /market.py | |
parent | bfe841c557094afad2db0d2c63deadeea4ba63c6 (diff) | |
parent | e967a372218df05424b1566a02cafe2432d57326 (diff) | |
download | Trader-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.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,4 +1,4 @@ | |||
1 | from ccxt import ExchangeError, NotSupported, RequestTimeout | 1 | from ccxt import ExchangeError, NotSupported, RequestTimeout, InvalidNonce |
2 | import ccxt_wrapper as ccxt | 2 | import ccxt_wrapper as ccxt |
3 | import time | 3 | import time |
4 | import psycopg2 | 4 | import 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() |