diff options
author | luxagraf <sng@luxagraf.net> | 2021-07-27 11:50:34 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2021-07-27 11:50:34 -0400 |
commit | 7ef866d37fa35aadb7ead8928b904395b49d52f8 (patch) | |
tree | b006f0edf7d35e19f76928c0f7ca7a29981b74a9 /app | |
parent | e9542c3f64d547765ebe132a31d12633d963a8e3 (diff) |
trad: added a table of options history
Diffstat (limited to 'app')
-rw-r--r-- | app/trading/templates/trading/list.html | 59 | ||||
-rw-r--r-- | app/trading/views.py | 1 |
2 files changed, 60 insertions, 0 deletions
diff --git a/app/trading/templates/trading/list.html b/app/trading/templates/trading/list.html index 60ab941..f2f7e26 100644 --- a/app/trading/templates/trading/list.html +++ b/app/trading/templates/trading/list.html @@ -196,6 +196,65 @@ <td>{{monthly_pl.pl__sum}}</td> </tr> </table> + + + <h3>Options History</h3> + <table> + <thead> + <tr> + <th>Symbol</th> + <th>Open/Close Date</th> + <th>Details</th> + <th>Entry Price</th> + <th>Stop</th> + <th>Target</th> + <th>Delta</th> + <th>Contract $</th> + <th># Contract</th> + <th>Contract Close $</th> + <th>Total Invested</th> + <th>Risk Total</th> + <th>Profit Goal</th> + <th>Profit/Loss</th> + <th>Notes</th> + </tr> + </thead> + {% for object in options_trades_closed %} + <tr class="{%if object.is_wanderer %}wanderer-trade {% endif %}{%if object.status == 2%}watching{% endif %}"> + <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> - {{object.close_date|date:"m-d-Y"}}</td> + <td> + <div class="{{object.call_put}}"> + <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.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.contract_close_price}}</td> + <td>${{object.amount_invested}}</td> + <td>${{object.risk_total}}</td> + <td>${{object.profit_goal}}</td> + <td>{{object.pl}}</td> + <td class="notes"> + {% if object.notes %} + <div class="wrapper"> + {{object.notes_html|safe}} + </div> + {% endif %} + </td> + {%if object.status == 2%}<td> + <a href="https://live.luxagraf.net/admin/trading/luxoptionstrade/{{object.pk}}/delete/">∅</a> + </td>{% endif %} + </tr> + {% endfor %} + </table> + {% endblock %} diff --git a/app/trading/views.py b/app/trading/views.py index 4f2c1d6..9922bd5 100644 --- a/app/trading/views.py +++ b/app/trading/views.py @@ -15,6 +15,7 @@ class LuxTradeListView(PaginatedListView): context['open_trades'] = LuxTrade.objects.filter(status=0) context['watch_trades'] = LuxTrade.objects.filter(status=2) context['options_trades'] = LuxOptionsTrade.objects.filter(status__in=[0,2]) + context['options_trades_closed'] = LuxOptionsTrade.objects.filter(status=1) context['monthly_pl'] = LuxTrade.stats.get_month_pl() context['month'] = datetime.now().strftime('%h') return context |