From b54394f01539472fe80624da3c58216936d98456 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Wed, 14 Jul 2021 16:01:53 -0400 Subject: trad: fixed a couple bugs --- app/trading/models.py | 4 ++-- app/trading/templates/trading/list.html | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/trading/models.py b/app/trading/models.py index f9c9881..ae9d8e0 100644 --- a/app/trading/models.py +++ b/app/trading/models.py @@ -113,11 +113,11 @@ class LuxTrade(models.Model): if self.stop_price > self.entry_price: return "No risk" else: - return (self.entry_price - self.stop_price)/(self.target_price-self.entry_price) + return round((self.entry_price - self.stop_price)/(self.target_price-self.entry_price),2) @property def goal_dollars(self): - return (self.target_price*self.shares)-(self.entry_price*self.shares) + return round((self.target_price*self.shares)-(self.entry_price*self.shares), 2) @property def goal_percent(self): diff --git a/app/trading/templates/trading/list.html b/app/trading/templates/trading/list.html index 83ccef2..fc3f1c5 100644 --- a/app/trading/templates/trading/list.html +++ b/app/trading/templates/trading/list.html @@ -15,11 +15,12 @@ $ Goal % Goal Risk/Reward + Price Calc {% for object in open_trades %} - {{object.symbol}} + {{object.symbol}} {{object.date|date:"m-d-Y"}} ${{object.entry_price}} ${{object.stop_price}} @@ -30,7 +31,7 @@ ${{object.goal_dollars}} {{object.goal_percent}} {{object.risk_reward}} - + {% endfor %} -- cgit v1.2.3-70-g09d2