summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2021-08-30 09:06:36 -0400
committerluxagraf <sng@luxagraf.net>2021-08-30 09:06:36 -0400
commit2d44c2ad39fdd75091d0ef4ecef28eca4f5168da (patch)
treec0f869c1284354a5ee7d8349d56c9e94e71fc566 /app
parent894cd0b50eb4ef0a9c0aa3779f10215720a5c7b8 (diff)
trad: added risk percentages to main options view
Diffstat (limited to 'app')
-rw-r--r--app/trading/models.py8
-rw-r--r--app/trading/templates/trading/list.html13
2 files changed, 16 insertions, 5 deletions
diff --git a/app/trading/models.py b/app/trading/models.py
index cbd58ed..80a67ed 100644
--- a/app/trading/models.py
+++ b/app/trading/models.py
@@ -286,8 +286,16 @@ class LuxOptionsTrade(models.Model):
else:
return round((((self.contract_price*self.number_contracts)*100)-((self.contract_close_price*self.number_contracts)*100)-self.fees), 2)
+ @property
+ def trade_risk_percent(self):
+ return round((self.risk_total/self.amount_invested)*100, 2);
@property
+ def portfolio_risk_percent(self):
+ return round((self.risk_total/10000)*100, 2);
+
+
+ @property
def realized_percent(self):
if self.call_put == 0:
return round((self.realized_dollars/self.amount_invested)*100, 2)
diff --git a/app/trading/templates/trading/list.html b/app/trading/templates/trading/list.html
index d27fd4f..38c7d46 100644
--- a/app/trading/templates/trading/list.html
+++ b/app/trading/templates/trading/list.html
@@ -80,15 +80,16 @@
<th>Symbol</th>
<th>Open Date</th>
<th>Details</th>
+ <th>Delta</th>
<th>Entry Price</th>
<th>Stop</th>
<th>Target</th>
- <th>Delta</th>
<th>Contract $</th>
- <th># Contract</th>
<th>Total Invested</th>
<th>Risk per</th>
- <th>Risk Total</th>
+ <th>$ Trade Risk</th>
+ <th>% Trade at Risk</th>
+ <th>% Portfolio at Risk</th>
<th>Profit Goal</th>
<th>Risk/Reward</th>
<th>Price Calc</th>
@@ -101,20 +102,22 @@
<td><a href="{{object.get_absolute_url}}">{{object.date|date:"m-d-Y"}}</a></td>
<td>
<div class="{{object.call_put}}">
+ <span>{{object.number_contracts}}</span>
<span>{{object.expiration_date|date:"M j"}}</span>
<span>{{object.days_until_expiration}}</span>
<span>{{object.get_call_put_display|first}}</span>
<span>${{object.strike_price}}</span>
</div>
+ <td>{{object.delta}}</td>
<td>${{object.entry_price}}</td>
<td>${{object.stop_price}}</td>
<td>${{object.target_price}}</td>
- <td>{{object.delta}}</td>
<td>${{object.contract_price}}</td>
- <td>{{object.number_contracts}}</td>
<td>${{object.amount_invested}}</td>
<td>${{object.risk_per_contract}}</td>
<td>${{object.risk_total}}</td>
+ <td>${{object.trade_risk_percent}}</td>
+ <td>${{object.portfolio_risk_percent}}</td>
<td>${{object.profit_goal}}</td>
<td>{{object.risk_reward}}</td>
<td>