summaryrefslogtreecommitdiff
path: root/app/trading/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2021-07-15 09:54:32 -0400
committerluxagraf <sng@luxagraf.net>2021-07-15 09:54:32 -0400
commit8af402161ed8cf7d67c5e44c36f5bad6e23c5cb2 (patch)
tree6bf41e0f2b9d399eb22e7aef060aea6fecb5313c /app/trading/models.py
parentb54394f01539472fe80624da3c58216936d98456 (diff)
trad: added some details to closed trades
Diffstat (limited to 'app/trading/models.py')
-rw-r--r--app/trading/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/trading/models.py b/app/trading/models.py
index ae9d8e0..0b79c9e 100644
--- a/app/trading/models.py
+++ b/app/trading/models.py
@@ -136,11 +136,11 @@ class LuxTrade(models.Model):
@property
def realized_dollars(self):
- return (self.close_price*self.shares)-(self.entry_price*self.shares)
+ return round((self.close_price*self.shares)-(self.entry_price*self.shares), 2)
@property
def realized_percent(self):
- return (self.realized_dollars/self.amount_invested)*100
+ return round((self.realized_dollars/self.amount_invested)*100, 2)
def save(self, *args, **kwargs):
if self.status == 0 and not self.open_date: