Skip to content

Instantly share code, notes, and snippets.

@johnwcothran
Last active July 13, 2018 18:29
Show Gist options
  • Save johnwcothran/8170bf11c4a17e1ae9b1ad88c83468ad to your computer and use it in GitHub Desktop.
Save johnwcothran/8170bf11c4a17e1ae9b1ad88c83468ad to your computer and use it in GitHub Desktop.
import R from 'ramda';
import fetch from 'node-fetch';
const getData = async () => {
const response = await fetch("https://api.iextrading.com/1.0/stock/aapl/batch?types=quote,news,chart&range=5y&last=1");
const json = await response.json();
return json.chart.map(({date, close}) => ({date: new Date(date), value: close}));
};
getData().then(res => console.log(R.head(res)));
// { date: Sun Jul 10 2016 20:00:00 GMT-0400 (EDT), value: 93.7011 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment