diff options
-rw-r--r-- | app/trading/models.py | 4 | ||||
-rw-r--r-- | 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 @@ <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> |