aboutsummaryrefslogtreecommitdiffstats
path: root/OLD/csci4131/hw7/public/stock.html
diff options
context:
space:
mode:
Diffstat (limited to 'OLD/csci4131/hw7/public/stock.html')
-rw-r--r--OLD/csci4131/hw7/public/stock.html123
1 files changed, 0 insertions, 123 deletions
diff --git a/OLD/csci4131/hw7/public/stock.html b/OLD/csci4131/hw7/public/stock.html
deleted file mode 100644
index ae9d077..0000000
--- a/OLD/csci4131/hw7/public/stock.html
+++ /dev/null
@@ -1,123 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <style>
- pre {
- max-height: 12em;
- }
- textarea {
- width: 100%;
- min-height: 30rem;
- background-color: black;
- font-family: "Lucida Console", Monaco, monospace;
- font-size: 0.75 rem;
- line-height: 1.2;
- color: #fff;
- }
- </style>
-</head>
-
-<body>
- <nav class="navbar navbar-default">
- <div class="container-fluid">
- <ul class="nav navbar-nav">
- <li><a href="/"><b>Home</b></a></li>
- <li><a href="contacts"><b>Contacts</b></a></li>
- <li><a href="stock"><b>Stock Page</b></a></li>
- <li><a href="logout"><b>Logout</b></a></li>
- </ul>
- </div>
- </nav>
- <br><br>
-
- <div class="container">
- <div class="panel panel-default">
- <div class="panel-body"><center>Welcome to Stock Page</center></div>
- </div>
- </div>
-
- <div class="container">
- <div class="row">
- <div class="col">
- <table class="table table-bordered table-hover">
- <tbody>
- <tr>
- <td class="col-md-6">Company</td>
- <td class="col-md-6">
- <div class="form-group">
- <select id="Company" name="Company">
- <option value="GME">Gamestop</option>
- <option value="MSFT">Microsoft</option>
- <option value="BA">Boeing Company</option>
- <option value="AAPL">Apple Inc</option>
- <option value="AMZN">Amazon</option>
- <option value="NVDA">NVIDIA Corporation</option>
- </select>
- </div>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <button type="button" onclick="Click()">Get Data</button>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
-
- <div class="container">
- <div id="chartContainer"></div>
- </div>
-
- <div class="container">
- <table class="table" id="StockData">
- <thead>
- <tr>
- <th scope="col" id="meta">Company-MetaData</th>
- <th scope="col" id="Time">Stock-Info</th>
- </tr>
- </thead>
- <pre>
- <tbody></tbody>
- </pre>
- </table>
- </div>
-
- <script>
- function Click() {
- var comp = document.getElementById("Company").value;
- var xmlhttp = new XMLHttpRequest();
- var url = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=" + comp + "&apikey=8MWSNPDWKH0BTBH2";
- xmlhttp.onreadystatechange = function () {
- if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
- var parse = JSON.parse(xmlhttp.responseText);
- var table = document.getElementById("StockData").getElementsByTagName("tbody")[0];
- var row = table.insertRow();
- for (var i in parse) {
- var cell = row.insertCell();
- cell.innerHTML = "<pre>" + JSON.stringify(parse[i], undefined, 2) + "</pre>";
- }
- }
- }
- xmlhttp.open("GET", url, true);
- xmlhttp.send();
-
- }
- /* TODO:
- / Bonus 1. Request the TIME_SERIES_DAILY endpoint of alphavantage API
- / for the company selected in the dropdown. Display the JSON
- / in the result according to the write up.
- / Bonus 2. Take the JSON from the alphavantage API and chart it to a
- / line chart using Chart.js to the chartContainer div. Ensure
- / the chart meets all requirements from the HW writeup.
- /*/
- </script>
-</body>
-</html>