Skip to content

Instantly share code, notes, and snippets.

@infantiablue
Created April 28, 2021 09:10
Show Gist options
  • Save infantiablue/3c8f54f125484f398633f0e74431c735 to your computer and use it in GitHub Desktop.
Save infantiablue/3c8f54f125484f398633f0e74431c735 to your computer and use it in GitHub Desktop.
const fetchData = async () => {
let data = { index: [], price: [], volumes: [] };
let result = await callAPI("https://api.coingecko.com/api/v3/coins/ethereum/market_chart?vs_currency=usd&days=1&interval=1m");
for (const item of result.prices) {
data.index.push(item[0]);
data.price.push(item[1]);
}
for (const item of result.total_volumes) data.volumes.push(item[1]);
return data;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment