Skip to content

Commit

Permalink
fix-add-metaData
Browse files Browse the repository at this point in the history
  • Loading branch information
howdyAnkit committed Aug 9, 2020
1 parent 79dcbdd commit 3150fd4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
18 changes: 16 additions & 2 deletions routes/api/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,26 @@ const {
router.get("/:symbol", ensureAuth, async (req, res) => {
const symbol = req.params.symbol;
let data = await getOverview(symbol);
let AssetType = data["AssetType"];
let assetName = data["Name"];
let assetExchange = data["Exchange"];
let Currency = data['Currency'];
let Country = data['Country'];
let Sector = data['Sector'];
let MarketCap = data['MarketCap'];
let Ebitda = data['EBITDA'];
let PERatio = data['PERatio'];

// console.log(data);
alpha.data
.intraday(symbol)
.then((data) => {
const intraDay = data["Time Series (1min)"];
const symbol = data["Meta Data"]['2. Symbol'];

const assetInformation = data["Meta Data"]['1. Information'];
const lastRefreshed = data["Meta Data"]['3. Last Refreshed'];


let dates = [];
let opening = [];
let closing = [];
Expand All @@ -47,7 +61,7 @@ router.get("/:symbol", ensureAuth, async (req, res) => {
res
.status(200)
.render(
"view", { symbol, data, dates, opening, closing, highs, lows, volumes }
"view", {symbol, data, dates, opening, closing, highs, lows, volumes, AssetType, assetName,assetExchange,Currency,Country,Sector,MarketCap,Ebitda,PERatio}
);
})
.catch((err) => {
Expand Down
28 changes: 28 additions & 0 deletions views/view.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,34 @@
</form>

<canvas id="chart"></canvas>
<table class="justify-start sm:justify-center lg:justify-center table-auto border-2 border-gray-600">
<thead>
<tr>
<th class="px-4 py-2">AssetType</th>
<th class="px-4 py-2">assetExchange</th>
<th class="px-4 py-2">assetExchange</th>
<th class="px-4 py-2">Currency</th>
<th class="px-4 py-2">Country</th>
<th class="px-4 py-2">Sector</th>
<th class="px-4 py-2">MarketCap</th>
<th class="px-4 py-2">Earnings</th>
<th class="px-4 py-2">PERatio</th>
</tr>
</thead>
<tbody>
<tr>
<td class="border-b-2 px-4 py-2 "><%- AssetType %></td>
<td class="border-b-2 px-4 py-2"><%- assetExchange %></td>
<td class="border-b-2 px-4 py-2"><%- assetExchange %></td>
<td class="border-b-2 px-4 py-2"><%- Currency %></td>
<td class="border-b-2 px-4 py-2"><%- Country %></td>
<td class="border-b-2 px-4 py-2"><%- Sector %></td>
<td class="border-b-2 px-4 py-2"><%- MarketCap %></td>
<td class="border-b-2 px-4 py-2"><%- Ebitda %></td>
<td class="border-b-2 px-4 py-2"><%- PERatio %></td>
</tr>
</tbody>
</table>

<%for(var i=0; i<=5; i++){%>
<table class="justify-start sm:justify-center lg:justify-center table-auto border-2 border-gray-600">
Expand Down

0 comments on commit 3150fd4

Please sign in to comment.