summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2021-07-14 16:01:53 -0400
committerluxagraf <sng@luxagraf.net>2021-07-14 16:01:53 -0400
commitb54394f01539472fe80624da3c58216936d98456 (patch)
treefa4cc6aea4d037ec9f2218e9cb02802889e163b8
parenta7d89d654048ce6d6651f842e2b2389c575dfb1d (diff)
trad: fixed a couple bugs
-rw-r--r--app/trading/models.py4
-rw-r--r--app/trading/templates/trading/list.html5
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 @@
<th>$ Goal</th>
<th>% Goal</th>
<th>Risk/Reward</th>
+ <th>Price Calc</th>
</tr>
</thead>
{% for object in open_trades %}
<tr>
- <td><a href="">{{object.symbol}}</a></td>
+ <td><a href="https://www.tradingview.com/chart/?symbol={{object.symbol}}" target="_blank">{{object.symbol}}</a></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>
@@ -30,7 +31,7 @@
<td>${{object.goal_dollars}}</td>
<td>{{object.goal_percent}}</td>
<td>{{object.risk_reward}}</td>
- <td><input id="id_close_price"> <span id=profit"></span></td>
+ <td><input class="close_price_calc" id="id_close_price_{{forloop.counter}}"> <span id=profit"></span></td>
</tr>
{% endfor %}
</table>