Published
Edited
Jan 31, 2021
1 fork
Importers
Also listed in…
D3 Class
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

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more