From e5cb45170ff352c9066eabb3579e9d77a34c6aa0 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Mon, 30 Aug 2021 09:14:33 -0400 Subject: trad: added the ability to close and options trade --- app/trading/templates/trading/list.html | 4 ++-- app/trading/templates/trading/update_options_form.html | 13 ------------- app/trading/views.py | 5 ++++- 3 files changed, 6 insertions(+), 16 deletions(-) (limited to 'app/trading') diff --git a/app/trading/templates/trading/list.html b/app/trading/templates/trading/list.html index a132cd6..f8957bd 100644 --- a/app/trading/templates/trading/list.html +++ b/app/trading/templates/trading/list.html @@ -88,8 +88,8 @@ Total Invested Risk per $ Trade Risk - % Trade at Risk - % Portfolio at Risk + % Trade Risk + % Portfolio Risk Profit Goal Risk/Reward Price Calc diff --git a/app/trading/templates/trading/update_options_form.html b/app/trading/templates/trading/update_options_form.html index a352cb3..3d40738 100644 --- a/app/trading/templates/trading/update_options_form.html +++ b/app/trading/templates/trading/update_options_form.html @@ -51,18 +51,5 @@ function calcPercentPortfolio() { id_form.addEventListener("input", function (e) { calcPercentPortfolio(); }); -var form = document.getElementById('id_form'); -function processForm(e) { - if (e.preventDefault) e.preventDefault(); - if(!confirm("Do you really want to do this?")) { - return false; - } - form.submit(); -} -if (form.attachEvent) { - form.attachEvent("submit", processForm); -} else { - form.addEventListener("submit", processForm); -} {% endblock %} diff --git a/app/trading/views.py b/app/trading/views.py index 9e19c05..2fb960a 100644 --- a/app/trading/views.py +++ b/app/trading/views.py @@ -47,6 +47,7 @@ class LuxOptionsTradeDetailView(UpdateView): fields = [ 'symbol', 'status', + 'close_date', 'entry_price', 'stop_price', 'target_price', @@ -54,9 +55,11 @@ class LuxOptionsTradeDetailView(UpdateView): 'expiration_date', 'strike_price', 'contract_price', + 'contract_close_price', 'number_contracts', 'delta', - 'notes' + 'notes', + 'pl' ] template_name = 'trading/update_options_form.html' success_url = '/trading/' -- cgit v1.2.3-70-g09d2