Published
Edited
Jan 31, 2021
1 fork
Importers
Also listed in…
CAP 6737
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
new Date(18000)
Insert cell
Insert cell
getQuote(ticker)
Insert cell
Insert cell
Insert cell
getQuoteHistory('AAPL', 15)
Insert cell
{
const data = getTickerHistoryData('AAPL', 15);
return data;
}
Insert cell
getTickerHistoryData = async (ticker, days) => {
const response = await getQuoteHistory(ticker, days);
// Combine timestamp, high, close, open, low, volume, adjusted close
const timestamp = response.chart.result[0].timestamp;
const quote = response.chart.result[0].indicators.quote[0];
return timestamp.map((time, i) => ({
date: d3.timeFormat("%x")(d3.timeParse("%s")(time)),
volume: quote.volume[i],
high: quote.high[i],
close: quote.close[i],
low: quote.low[i],
open: quote.open[i]
}));
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more