diff options
author | luxagraf <sng@luxagraf.net> | 2021-08-19 11:46:53 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2021-08-19 11:46:53 -0400 |
commit | 894cd0b50eb4ef0a9c0aa3779f10215720a5c7b8 (patch) | |
tree | 1e8dcccf75dff076c9aa74b2ffa3cb506554e940 /app | |
parent | 9a4c84cdcfcc33308e1092ad2464a81c29b84eb2 (diff) |
trad: fixed a little bug in realized percent
Diffstat (limited to 'app')
-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: |