-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
98 lines (82 loc) · 3.71 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<!-- Chart.js script -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.2.0/chart.min.js" integrity="sha512-VMsZqo0ar06BMtg0tPsdgRADvl0kDHpTbugCBBrL55KmucH6hP9zWdLIWY//OTfMnzz6xWQRxQqsUFefwHuHyg==" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.2.0/Chart.min.css" integrity="sha256-aa0xaJgmK/X74WM224KMQeNQC2xYKwlAt08oZqjeF0E=" crossorigin="anonymous" />
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous"></script>
<title>Stock Screener</title>
</head>
<body style="background-color: black">
<div class="container">
<h1 style="margin-top: 25px; color: white; text-align: center">Stock Screener with Django and Chart.js</h1>
<form style="margin-top: 25px" method="post" action="" class="d-flex justify-content-center align-items-center">
{% csrf_token %}
<select name="ticker" class="form-control" style="width: 200px">
<option disabled selected value>select a stock ticker</option>
{% for ticker in tickers %}
<option>{{ ticker }}</option>
{% endfor %}
</select>
<input type="submit" name="" class="btn btn-danger m-1">
</form>
<h1 style="color: white; text-align: center; margin-top: 25px; margin-bottom: 25px">{{ticker}}:</h1>
</div>
<script>
$(document).ready(function(){
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: [{% for i in index %}'{{ i }}',{% endfor %}],
datasets: [{
label: '{{tic}} Close Price USD',
data: [{% for price in prices %}{{ price }},{% endfor %}],
borderWidth: 1,
fill: false,
borderColor: 'blue',
pointRadius: 0,
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
xAxes: [{
type: 'time'
}]
},
ticks: {
autoSkip: true,
maxTicksLimit: 11
}
}
});
});
</script>
<div class="container" style="margin-top: 25px; margin-bottom: 25px" >
<div class="card">
<div class="card-header" style="text-align: center;">
Historical Stock Prices [USD] (adjusted for dividends and splits)
</div>
<div class="card-body">
<canvas id="myChart"></canvas>
</div>
</div>
</div>
<div class="container">
<p style="color: grey; text-align: center;">Developed by <span style="color: white">Tim Boelsen</span></p>
</div>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
</body>
</html>