diff options
author | luxagraf <sng@luxagraf.net> | 2021-07-14 09:31:15 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2021-07-14 09:31:15 -0400 |
commit | 39086b58106ff6181d029e0ef845593605821873 (patch) | |
tree | b6652d1b74c1187eafbd0fbd74a3f00f4f1c9c58 /app/trading/templates | |
parent | c2c0421207694aa5eb148f05a57440716ae2dc8d (diff) |
trading: added trading to toolset
Diffstat (limited to 'app/trading/templates')
-rw-r--r-- | app/trading/templates/products/snippet.html | 41 | ||||
-rw-r--r-- | app/trading/templates/trading/base.html | 30 | ||||
-rw-r--r-- | app/trading/templates/trading/create_form.html | 67 | ||||
-rw-r--r-- | app/trading/templates/trading/list.html | 107 | ||||
-rw-r--r-- | app/trading/templates/trading/update_form.html | 20 |
5 files changed, 265 insertions, 0 deletions
diff --git a/app/trading/templates/products/snippet.html b/app/trading/templates/products/snippet.html new file mode 100644 index 0000000..3fc9f6f --- /dev/null +++ b/app/trading/templates/products/snippet.html @@ -0,0 +1,41 @@ +{% load get_image_by_size %} +{% load get_image_width %} +{% with image=object.featured_image %} +<div itemscope itemtype="http://schema.org/Product" class="product-card"> + <meta itemprop="brand" content="{{object.brand.name}}" /> + <figure itemscope itemtype="http://schema.org/ImageObject" class="picfull"> + <a href="{% get_image_by_size image 'original' %}" title="view larger image"> + <img class="u-photo" itemprop="contentUrl" sizes="(max-width: 750px) 100vw, (min-width: 751) 750px" srcset="{% for size in image.sizes.all%}{% get_image_by_size image size.name %} {{size.width}}w{% if forloop.last%}"{%else%}, {%endif%}{%endfor%}{% for size in image.sizes.all%}{%if not forloop.first and not forloop.last%} src="{% get_image_by_size image size.name%}"{%endif%}{%endfor%} alt="{{image.alt}} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}luxagraf{%endif%}" > + </a> + <figcaption>{% if image.caption %}{{image.caption|safe}}{% endif %}{% if image.photo_credit_source %}{%if image.caption %} | {%endif%}image: {% if image.photo_credit_url %}<a href="{{image.photo_credit_url}}" itemprop="author">{%endif%}{{image.photo_credit_source|lower}}{% if image.photo_credit_url %}</a>{%endif%}{%endif%} + </figcaption> + </figure> + <div class="buy-btn-wrapper"> + <h4 class="product-header" itemprop="name">{{object.get_full_name}}</h4> + <h5 class="product-link" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> + <a href="{{object.primary_offer_url}}" title="buy the {{object.get_full_name}} for ${{object.primary_offer_price}} from {{object.primary_offer_retailer.get_primary_offer_retailer_display}}" itemprop="url" rel="nofollow"> + Buy Now ({{object.get_primary_offer_retailer_display}} + <span itemprop="priceCurrency" content="USD">$</span><span itemprop="price" content="{{object.primary_offer_price}}">{{object.primary_offer_price}}</span>) + </a> + <link itemprop="availability" href="http://schema.org/InStock" /> + </h5>{% if object.secondary_offer_url %} + <h5 class="product-link" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> + <a href="{{object.secondary_offer_url}}" title="buy the {{object.get_full_name}} for ${{object.secondary_offer_price}} from {{object.secondary_offer_retailer.get_secondary_offer_retailer_display}}" itemprop="url"> + Buy Now ({{object.get_secondary_offer_retailer_display}} + <span itemprop="priceCurrency" content="USD">$</span><span itemprop="price" content="{{object.secondary_offer_price}}">{{object.secondary_offer_price}}</span>) + </a> + <link itemprop="availability" href="http://schema.org/InStock" /> + </h5>{% endif %} + </div> + <span itemprop="review" itemscope itemtype="http://schema.org/Review"> + <meta itemprop="name" content="{{object.get_full_name}}" /> + <meta itemprop="author" content="Scott Gilbertson" /> + <meta itemprop="datePublished" content="{{object.pub_date}}" /> + <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> + <meta itemprop="worstRating" content = "1"/> + <meta itemprop="ratingValue" content="{{object.rating}}" /> + <meta itemprop="bestRating" content="10" /> + </span> + <meta itemprop="description" content="{{object.body_markdown}}" /> +</div> +{% endwith %} diff --git a/app/trading/templates/trading/base.html b/app/trading/templates/trading/base.html new file mode 100644 index 0000000..86023ba --- /dev/null +++ b/app/trading/templates/trading/base.html @@ -0,0 +1,30 @@ +<html> +<head> + <title>{% block pagetitle %}Luxagraf - Topografical Writings{% endblock %}</title> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + {%block stylesheet%}<link rel="stylesheet" + href="/media/trading.css{%comment%}?{% now "u" %}{%endcomment%}" + media="screen">{%endblock%} + <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> + {%block extrahead%}{%endblock%} +</head> + </head> + <body> + <nav> + <span class="nav-item"><a href="{% url 'luxtrade:list' %}">Home</a></span> + <span class="nav-item"><a href="{% url 'luxtrade:testtrade' %}">Test Trade</a></span> + <span class="nav-item"><a href="{% url 'luxtrade:testtrade' %}">Test Options</a></span> + <span class="nav-item"><a href="https://wandererfinancial.com/{% now 'n-j-y'%}-todays-market/" target="_blank">Wanderer</a></span> + <span class="nav-item"><a href="https://www.tradingview.com/chart/1a1NjVtp/" target="_blank">Trading View</a></span> + <span class="nav-item"><a href="https://client.schwab.com/Areas/Accounts/Positions" target="_blank">Schwab Positions</a></span> + <span class="nav-item"><a href="https://client.schwab.com/Areas/Trade/Stocks/Entry.aspx?" target="_blank">Schwab New Trade</a></span> + </nav> + {% block content %} + {% endblock %} + </body> + {% block js %} + {% endblock %} +</html> + diff --git a/app/trading/templates/trading/create_form.html b/app/trading/templates/trading/create_form.html new file mode 100644 index 0000000..521d420 --- /dev/null +++ b/app/trading/templates/trading/create_form.html @@ -0,0 +1,67 @@ +{% extends 'trading/base.html' %} +{% load typogrify_tags %} + {% block content %} + <form id="id_form" action="/trading/model" method="post">{% csrf_token %} + {% for field in form %} + <fieldset> + {{ field.errors }} + {% if field.name == 'status'%} + <label class="hide" for="id_status">Status:</label>{{ field }} + {% else %} + {{ field.label_tag }} {{ field }} + {% endif %} + {% if field.help_text %} + <p class="help">{{ field.help_text|safe }}</p> + {% endif %} + </fieldset> +{% endfor %} + <input type="submit" name="post" class="btn" value="record purchase"/> + </form> + <dl> + <dt>R/R: </dt><dd id="id_rr"></dd> + <dt>% Portfolio: </dt><dd id="id_p_portfolio"></dd> + <dt>Risk: </dt><dd id="id_risk"></dd> + <dt>Total Invested: </dt><dd id="id_total"></dd> + <dt>$ Goal: </dt><dd id="id_reward"></dd> + <dt>% Goal: </dt><dd id="id_reward_percent"></dd> + </dl> + {% endblock %} + + {% block js %} +<script> +function calcPercentPortfolio() { + var entry_price = document.getElementById("id_entry_price").value; + var stop_price = document.getElementById("id_stop_price").value; + var target_price = document.getElementById("id_target_price").value; + var shares = document.getElementById("id_shares").value; + var pp = (entry_price*shares)/20000; + var risk_dollars = (entry_price-stop_price)*shares; + var goal = (target_price*shares)-(entry_price*shares); + var rr = (entry_price-stop_price)/(target_price-entry_price); + var total = entry_price*shares + var percent_goal = (goal/total)*100 + document.getElementById("id_p_portfolio").innerText = (pp*100).toFixed(2); + document.getElementById("id_risk").innerText = "$"+risk_dollars.toFixed(2); + document.getElementById("id_reward").innerText = "$"+goal.toFixed(2); + document.getElementById("id_reward_percent").innerText = percent_goal.toFixed(0)+"%"; + document.getElementById("id_rr").innerText = rr.toFixed(2); + document.getElementById("id_total").innerText = "$"+total.toFixed(2); +} +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); +} +</script> + {% endblock %} diff --git a/app/trading/templates/trading/list.html b/app/trading/templates/trading/list.html new file mode 100644 index 0000000..fd754b6 --- /dev/null +++ b/app/trading/templates/trading/list.html @@ -0,0 +1,107 @@ +{% extends 'trading/base.html' %} + {% block content %} + <h3>Current Trades</h3> + <table> + <thead> + <tr> + <th>Open Date</th> + <th>Symbol</th> + <th>Entry Price</th> + <th>Stop</th> + <th>Target</th> + <th>Shares</th> + <th>Total Invested</th> + <th>$ at Risk</th> + <th>$ Goal</th> + <th>% Goal</th> + <th>Risk/Reward</th> + </tr> + </thead> + {% for object in open_trades %} + <tr> + <td><a href="{{object.get_absolute_url}}">{{object.date|date:"m-d-Y"}}</a></td> + <td>{{object.symbol}}</td> + <td>${{object.entry_price}}</td> + <td>${{object.stop_price}}</td> + <td>${{object.target_price}}</td> + <td>{{object.shares}}</td> + <td>${{object.amount_invested}}</td> + <td>${{object.risk_dollars}}</td> + <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> + </tr> + {% endfor %} + </table> + + <h3>Watching </h3> + <table> + <thead> + <tr> + <th>Open Date</th> + <th>Symbol</th> + <th>Entry Price</th> + <th>Stop</th> + <th>Target</th> + <th>Shares</th> + <th>Total Invested</th> + <th>$ at Risk</th> + <th>$ Goal</th> + <th>% Goal</th> + <th>Risk/Reward</th> + </tr> + </thead> + {% for object in watch_trades %} + <tr> + <td>{{object.date|date:"m-d-Y"}}</td> + <td>{{object.symbol}}</td> + <td>${{object.entry_price}}</td> + <td>${{object.stop_price}}</td> + <td>${{object.target_price}}</td> + <td>{{object.shares}}</td> + <td>${{object.amount_invested}}</td> + <td>${{object.risk_dollars}}</td> + <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> + </tr> + {% endfor %} + </table> + <h3>Trade History</h3> + <table> + <thead> + <tr> + <th>Date Purchased</th> + <th>Symbol</th> + <th>Entry Price</th> + <th>Stop Price</th> + <th>Target Price</th> + <th>Number of Shares</th> + <th>Total Invested</th> + <th>$ at Risk</th> + <th>% at Risk</th> + <th>$ Goal</th> + <th>% Goal</th> + <th>Risk/Reward</th> + </tr> + </thead> + {% for object in object_list %} + <tr> + <td>{{object.date}}</td> + <td>{{object.symbol}}</td> + <td>${{object.entry_price}}</td> + <td>${{object.stop_price}}</td> + <td>${{object.target_price}}</td> + <td>{{object.shares}}</td> + <td>${{object.amount_invested}}</td> + <td>${{object.risk_dollars}}</td> + <td>{{object.risk_percent}}</td> + <td>${{object.goal_dollars}}</td> + <td>{{object.goal_percent}}</td> + <td>{{object.risk_reward}}</td> + </tr> + {% endfor %} + </table> + {% endblock %} diff --git a/app/trading/templates/trading/update_form.html b/app/trading/templates/trading/update_form.html new file mode 100644 index 0000000..01e0875 --- /dev/null +++ b/app/trading/templates/trading/update_form.html @@ -0,0 +1,20 @@ +{% extends 'trading/base.html' %} +{% load typogrify_tags %} +{% block content %} + <form id="id_form" action="" method="post">{% csrf_token %} + {% for field in form %} + <fieldset> + {{ field.errors }} + {% if field.name == 'status'%} + <label class="hide" for="id_status">Status:</label>{{ field }} + {% else %} + {{ field.label_tag }} {{ field }} + {% endif %} + {% if field.help_text %} + <p class="help">{{ field.help_text|safe }}</p> + {% endif %} + </fieldset> +{% endfor %} + <input type="submit" name="post" class="btn" value="update trade"/> + </form> + {% endblock %} |