From 8af402161ed8cf7d67c5e44c36f5bad6e23c5cb2 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Thu, 15 Jul 2021 09:54:32 -0400 Subject: trad: added some details to closed trades --- app/trading/models.py | 4 ++-- app/trading/templates/trading/list.html | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'app') 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: diff --git a/app/trading/templates/trading/list.html b/app/trading/templates/trading/list.html index fc3f1c5..c43a1ff 100644 --- a/app/trading/templates/trading/list.html +++ b/app/trading/templates/trading/list.html @@ -40,8 +40,8 @@ - + @@ -55,8 +55,8 @@ {% for object in watch_trades %} - + @@ -82,15 +82,14 @@ - - - + + {% for object in object_list %} - + @@ -98,10 +97,9 @@ - - - + + {% endfor %}
Open Date SymbolOpen Date Entry Price Stop Target
{{object.date|date:"m-d-Y"}} {{object.symbol}}{{object.date|date:"m-d-Y"}} ${{object.entry_price}} ${{object.stop_price}} ${{object.target_price}}Number of Shares Total Invested $ at Risk% at Risk $ Goal% GoalRisk/RewardRealized $Realized %
{{object.date}}{{object.date|date:"m-d-Y"}} {{object.symbol}} ${{object.entry_price}} ${{object.stop_price}}{{object.shares}} ${{object.amount_invested}} ${{object.risk_dollars}}{{object.risk_percent}} ${{object.goal_dollars}}{{object.goal_percent}}{{object.risk_reward}}${{object.realized_dollars}}{{object.realized_percent}}
-- cgit v1.2.3