aboutsummaryrefslogtreecommitdiff
path: root/portfolio.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-05-01 16:02:00 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-05-01 16:02:00 +0200
commit1902674cbeaa4dc0cdc31e6f0f7a548b3fa7f38e (patch)
tree8773f0fbba805f0e4f76fb742da766b4f1a56073 /portfolio.py
parent52ea19aa73348a523b3b884e2a7fb749b2bf4f19 (diff)
downloadTrader-1902674cbeaa4dc0cdc31e6f0f7a548b3fa7f38e.tar.gz
Trader-1902674cbeaa4dc0cdc31e6f0f7a548b3fa7f38e.tar.zst
Trader-1902674cbeaa4dc0cdc31e6f0f7a548b3fa7f38e.zip
Don’t close dust remaining orders before end of trade.
Fixes https://git.immae.eu/mantisbt/view.php?id=41
Diffstat (limited to 'portfolio.py')
-rw-r--r--portfolio.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/portfolio.py b/portfolio.py
index c313fd9..c064249 100644
--- a/portfolio.py
+++ b/portfolio.py
@@ -578,12 +578,12 @@ class Order:
578 self.fetch_mouvements() 578 self.fetch_mouvements()
579 579
580 self.mark_disappeared_order() 580 self.mark_disappeared_order()
581 581 self.mark_dust_amount_remaining_order()
582 self.mark_finished_order() 582 self.mark_finished_order()
583 # FIXME: consider open order with dust remaining as closed
584 583
585 def dust_amount_remaining(self): 584 def mark_dust_amount_remaining_order(self):
586 return self.remaining_amount() < Amount(self.amount.currency, D("0.001")) 585 if self.market.ccxt.is_dust_trade(self.remaining_amount().value, self.rate):
586 self.status = "closed_dust_remaining"
587 587
588 def remaining_amount(self): 588 def remaining_amount(self):
589 return self.amount - self.filled_amount() 589 return self.amount - self.filled_amount()