summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/trading/models.py4
-rw-r--r--app/trading/templates/trading/list.html16
2 files changed, 9 insertions, 11 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:
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 @@
<table>
<thead>
<tr>
- <th>Open Date</th>
<th>Symbol</th>
+ <th>Open Date</th>
<th>Entry Price</th>
<th>Stop</th>
<th>Target</th>
@@ -55,8 +55,8 @@
</thead>
{% for object in watch_trades %}
<tr>
- <td>{{object.date|date:"m-d-Y"}}</td>
<td>{{object.symbol}}</td>
+ <td><a href="{{object.get_absolute_url}}">{{object.date|date:"m-d-Y"}}</a></td>
<td>${{object.entry_price}}</td>
<td>${{object.stop_price}}</td>
<td>${{object.target_price}}</td>
@@ -82,15 +82,14 @@
<th>Number of Shares</th>
<th>Total Invested</th>
<th>$ at Risk</th>
- <th>% at Risk</th>
<th>$ Goal</th>
- <th>% Goal</th>
- <th>Risk/Reward</th>
+ <th>Realized $</th>
+ <th>Realized %</th>
</tr>
</thead>
{% for object in object_list %}
<tr>
- <td>{{object.date}}</td>
+ <td><a href="{{object.get_absolute_url}}">{{object.date|date:"m-d-Y"}}</a></td>
<td>{{object.symbol}}</td>
<td>${{object.entry_price}}</td>
<td>${{object.stop_price}}</td>
@@ -98,10 +97,9 @@
<td>{{object.shares}}</td>
<td>${{object.amount_invested}}</td>
<td>${{object.risk_dollars}}</td>
- <td>{{object.risk_percent}}</td>
<td>${{object.goal_dollars}}</td>
- <td>{{object.goal_percent}}</td>
- <td>{{object.risk_reward}}</td>
+ <td>${{object.realized_dollars}}</td>
+ <td>{{object.realized_percent}}</td>
</tr>
{% endfor %}
</table>