from datetime import datetime
from retry import retry
from decimal import Decimal as D, ROUND_DOWN
-from ccxt import ExchangeError, InsufficientFunds, ExchangeNotAvailable, InvalidOrder, OrderNotCached, OrderNotFound, RequestTimeout
+from ccxt import ExchangeError, InsufficientFunds, ExchangeNotAvailable, InvalidOrder, OrderNotCached, OrderNotFound, RequestTimeout, InvalidNonce
class Computation:
computations = {
def finished(self):
return self.status.startswith("closed") or self.status == "canceled" or self.status == "error"
- @retry((InsufficientFunds, RetryException))
+ @retry((InsufficientFunds, RetryException, InvalidNonce))
def run(self):
self.tries += 1
symbol = "{}/{}".format(self.amount.currency, self.base_currency)
self.status = "closed"
self.mark_finished_order()
return
+ except InvalidNonce as e:
+ if self.tries < 5:
+ self.market.report.log_error(action, message="Retrying after invalid nonce", exception=e)
+ raise e
+ else:
+ self.market.report.log_error(action, message="Giving up {} after invalid nonce".format(self), exception=e)
+ self.status = "error"
+ return
except RequestTimeout as e:
if not self.retrieve_order():
if self.tries < 5: