diff options
Diffstat (limited to 'app/trading/models.py')
-rw-r--r-- | app/trading/models.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/trading/models.py b/app/trading/models.py index ad40c98..cbd58ed 100644 --- a/app/trading/models.py +++ b/app/trading/models.py @@ -289,7 +289,10 @@ class LuxOptionsTrade(models.Model): @property def realized_percent(self): - return round((self.realized_dollars/self.amount_invested)*100, 2) + if self.call_put == 0: + return round((self.realized_dollars/self.amount_invested)*100, 2) + else: + return round((self.pl/self.amount_invested)*100, 2) def save(self, *args, **kwargs): if self.status == 0 and not self.open_date: |