Ethereum: Anyone know of an API I can get historical price time series for multiple coins
Getting Historical Ethereum Price Data via API
As a cryptocurrency enthusiast and developer, you are probably looking for ways to build a robust portfolio tracking app. A key aspect is having access to historical price data for multiple coins. In this article, we will explore the possibilities of getting historical price time series data for various Ethereum-based assets via API.
Historical Price Data Requirements
To create highly accurate historical price charts using HighCharts js, you will need a reliable API that provides accurate and timely price data. Here are some key requirements:
- Data Frequency: Look for APIs that offer data at intervals of at least 1-2 minutes to ensure smooth rendering of time series.
- Asset Coverage: Make sure the API covers the Ethereum-based assets you are interested in, such as Bitcoin (BTC), Ethereum (ETH), and more.
- Data Format
: The API should return price data in a standard format such as CSV or JSON.
APIs for Historical Price Data
Here are some popular APIs that provide historical price data for multiple Ethereum-based assets:
- [CoinGecko API](
- Provides prices, volumes, and market cap for over 10,000 cryptocurrencies, including Ethereum.
- [Cryptocompare API](
- Provides historical price data for various cryptocurrency assets, including Ethereum.
- [CoinMarketCap API](
- Provides historical price data for over 12,000 cryptocurrencies, including Ethereum.
- [Binance API](
- Provides access to cryptocurrency market data, including prices and volumes.
Sample Code
Here is a sample code snippet that uses the CoinGecko API to retrieve historical price data for Bitcoin (BTC) and Ethereum (ETH):
const axios = require('axios');
async function getHistoricalPriceData() {
const apiEndpoint = '
try {
const response = await axios.get(apiEndpoint);
const data = response.data;
console.log(data);
// Use historical price data for Bitcoin and Ethereum
const bitcoinData = data[0];
const ethData = data[1];
// Create a HighCharts chart object
const chart = new Highcharts.Chart({
chart: {
type: 'line',
title: {
text: Historical price of ${bitcoinData.name} and ${ethData.name}
}
},
xAxis: {
tick: {
enable: true,
step: 1
}
},
series: [
{
name: bitcoinData.name,
type: 'line',
data: bitcoinData.price
},
{
name: ethData.name,
type: 'line',
data: ethData.price
}
]
});
} catch (error) {
console.error(error);
}
}
getHistoricalPriceData();
Conclusion
With these APIs and the sample code snippet, you will be able to retrieve historical price data for multiple Ethereum-based assets. This will allow you to build robust portfolio tracking apps using HighCharts js. Be sure to explore the documentation and pricing plans for each API to ensure a seamless integration experience.