aboutsummaryrefslogtreecommitdiff
path: root/portfolio.py
diff options
context:
space:
mode:
Diffstat (limited to 'portfolio.py')
-rw-r--r--portfolio.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/portfolio.py b/portfolio.py
index d8a5465..9b27e26 100644
--- a/portfolio.py
+++ b/portfolio.py
@@ -261,12 +261,12 @@ class Trade:
261 261
262 @property 262 @property
263 def is_fullfiled(self): 263 def is_fullfiled(self):
264 return abs(self.filled_amount(in_base_currency=(not self.inverted))) >= abs(self.delta) 264 return abs(self.filled_amount(in_base_currency=(not self.inverted), refetch=True)) >= abs(self.delta)
265 265
266 def filled_amount(self, in_base_currency=False): 266 def filled_amount(self, in_base_currency=False, refetch=False):
267 filled_amount = 0 267 filled_amount = 0
268 for order in self.orders: 268 for order in self.orders:
269 filled_amount += order.filled_amount(in_base_currency=in_base_currency) 269 filled_amount += order.filled_amount(in_base_currency=in_base_currency, refetch=refetch)
270 return filled_amount 270 return filled_amount
271 271
272 tick_actions = { 272 tick_actions = {
@@ -585,11 +585,11 @@ class Order:
585 if self.market.ccxt.is_dust_trade(self.remaining_amount().value, self.rate): 585 if self.market.ccxt.is_dust_trade(self.remaining_amount().value, self.rate):
586 self.status = "closed_dust_remaining" 586 self.status = "closed_dust_remaining"
587 587
588 def remaining_amount(self): 588 def remaining_amount(self, refetch=False):
589 return self.amount - self.filled_amount() 589 return self.amount - self.filled_amount(refetch=refetch)
590 590
591 def filled_amount(self, in_base_currency=False): 591 def filled_amount(self, in_base_currency=False, refetch=False):
592 if self.status == "open": 592 if refetch and self.status == "open":
593 self.fetch() 593 self.fetch()
594 filled_amount = 0 594 filled_amount = 0
595 for mouvement in self.mouvements: 595 for mouvement in self.mouvements: