diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-05-08 21:00:27 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-05-08 21:00:27 +0200 |
commit | 5321200c05b3b693581ec4238c74eb02e0b715d7 (patch) | |
tree | 893f0bd619deba53cd92895c97bd13e0a600feb9 /market.py | |
parent | 3a15ffc79ea84e5ec6200545bcbf11fc6c1c6564 (diff) | |
download | Trader-5321200c05b3b693581ec4238c74eb02e0b715d7.tar.gz Trader-5321200c05b3b693581ec4238c74eb02e0b715d7.tar.zst Trader-5321200c05b3b693581ec4238c74eb02e0b715d7.zip |
Check before processing that credentials are valid
Diffstat (limited to 'market.py')
-rw-r--r-- | market.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | from ccxt import ExchangeError, NotSupported, RequestTimeout, InvalidNonce | 1 | from ccxt import AuthenticationError, ExchangeError, NotSupported, RequestTimeout, InvalidNonce |
2 | import ccxt_wrapper as ccxt | 2 | import ccxt_wrapper as ccxt |
3 | import time | 3 | import time |
4 | import dbs | 4 | import dbs |
@@ -88,6 +88,7 @@ class Market: | |||
88 | 88 | ||
89 | def process(self, actions, before=False, after=False): | 89 | def process(self, actions, before=False, after=False): |
90 | try: | 90 | try: |
91 | self.ccxt.check_required_credentials() | ||
91 | for action in actions: | 92 | for action in actions: |
92 | if bool(before) is bool(after): | 93 | if bool(before) is bool(after): |
93 | self.processor.process(action, steps="all") | 94 | self.processor.process(action, steps="all") |
@@ -95,6 +96,8 @@ class Market: | |||
95 | self.processor.process(action, steps="before") | 96 | self.processor.process(action, steps="before") |
96 | elif after: | 97 | elif after: |
97 | self.processor.process(action, steps="after") | 98 | self.processor.process(action, steps="after") |
99 | except AuthenticationError: | ||
100 | self.report.log_error("market_authentication", message="Impossible to authenticate to market") | ||
98 | except Exception as e: | 101 | except Exception as e: |
99 | import traceback | 102 | import traceback |
100 | self.report.log_error("market_process", exception=e, message=traceback.format_exc()) | 103 | self.report.log_error("market_process", exception=e, message=traceback.format_exc()) |