diff options
-rw-r--r-- | portfolio.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/portfolio.py b/portfolio.py index 60b57ca..fc468c2 100644 --- a/portfolio.py +++ b/portfolio.py | |||
@@ -463,7 +463,7 @@ class Order: | |||
463 | 463 | ||
464 | @property | 464 | @property |
465 | def finished(self): | 465 | def finished(self): |
466 | return self.status == "closed" or self.status == "canceled" | 466 | return self.status == "closed" or self.status == "canceled" or self.status == "error" |
467 | 467 | ||
468 | def run(self, debug=False): | 468 | def run(self, debug=False): |
469 | symbol = "{}/{}".format(self.amount.currency, self.base_currency) | 469 | symbol = "{}/{}".format(self.amount.currency, self.base_currency) |
@@ -476,8 +476,12 @@ class Order: | |||
476 | try: | 476 | try: |
477 | self.result = self.market.create_order(symbol, 'limit', self.action, amount, price=self.rate) | 477 | self.result = self.market.create_order(symbol, 'limit', self.action, amount, price=self.rate) |
478 | self.status = "open" | 478 | self.status = "open" |
479 | except Exception: | 479 | except Exception as e: |
480 | pass | 480 | self.status = "error" |
481 | print("error when running market.create_order('{}', 'limit', '{}', {}, price={})".format( | ||
482 | symbol, self.action, amount, self.rate)) | ||
483 | self.error_message = str("{}: {}".format(e.__class__.__name__, e)) | ||
484 | print(self.error_message) | ||
481 | 485 | ||
482 | def get_status(self): | 486 | def get_status(self): |
483 | # other states are "closed" and "canceled" | 487 | # other states are "closed" and "canceled" |