From: Ismaƫl Bouya Date: Mon, 14 May 2018 06:22:29 +0000 (+0200) Subject: Merge branch 'dev' X-Git-Tag: v1.8.3 X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git;a=commitdiff_plain;h=27bad39d3f2efcec0247b473627088149f462f79;hp=c3e265216a5e97ec8363bf3c22dcd0539debe77f Merge branch 'dev' --- diff --git a/portfolio.py b/portfolio.py index 9b27e26..bed4326 100644 --- a/portfolio.py +++ b/portfolio.py @@ -582,7 +582,7 @@ class Order: self.mark_finished_order() def mark_dust_amount_remaining_order(self): - if self.market.ccxt.is_dust_trade(self.remaining_amount().value, self.rate): + if self.status == "open" and self.market.ccxt.is_dust_trade(self.remaining_amount().value, self.rate): self.status = "closed_dust_remaining" def remaining_amount(self, refetch=False): diff --git a/tests/test_portfolio.py b/tests/test_portfolio.py index 6ca3327..bc69921 100644 --- a/tests/test_portfolio.py +++ b/tests/test_portfolio.py @@ -832,6 +832,10 @@ class OrderTest(WebMockTestCase): self.m.ccxt.is_dust_trade.return_value = True order.mark_dust_amount_remaining_order() + self.assertEqual("pending", order.status) + + order.status = "open" + order.mark_dust_amount_remaining_order() self.assertEqual("closed_dust_remaining", order.status) @mock.patch.object(portfolio.Order, "fetch")