-
Notifications
You must be signed in to change notification settings - Fork 72
/
index.html
69 lines (52 loc) · 1.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Stocks Dashboard</title>
</head>
<body>
<h1>My Stocks Dashboard</h1>
<h2>Inputs</h2>
<div>
<label>AlphaVantage API Key:</label>
<input type="text" name="api-key" id="my-api-key" placeholder="demo" value="demo">
<br>
<label>Stock:</label>
<select id="my-stock-selector">
<option value="MSFT" selected>Microsoft (MSFT)</option>
<option value="GOOG">Google (GOOGL)</option>
<option value="AAPL">Apple (AAPL)</option>
<option value="TSLA">Tesla (TSLA)</option>
</select>
<br>
<button id="my-submit-btn">Go!</button>
</div>
<hr>
<h2>Outputs</h2>
<div>
<p>Selected Stock: <span id="display-stock-symbol">_____________</span></p>
<p>Latest (Adjusted) Closing Price: <span id="display-latest-closing-price">__________</span></p>
</div>
<div id="dataviz-container"></div>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script type="text/javascript">
//
// When the button is clicked:
// ... 1) capture input values
// ... 2) compile the right URL given the provided inputs
// ... 3) fetch data from that URL
// ... 4) crunch the data
// ... 5) overwrite the HTML display values (symbol, latest close)
// ... 6) make a dataviz
//
console.log("TODO: RESPOND TO BUTTON CLICKS AND CAPTURE FORM INPUTS")
var apiKey = "TODO"
var symbol = "TODO"
var requestUrl = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=" + symbol + "&apikey=" + apiKey
console.log("REQUEST URL:", requestUrl)
console.log("TODO: FETCH DATA")
console.log("TODO: DISPLAY DATA")
console.log("TODO: DATAVIZ")
</script>
</body>
</html>