Getting Historical Ethereum Price Data Using API
As a cryptocurrency enthusiast and developer, you are probably looking for ways to build a robust portfolio tracking application. One key aspect is accessing 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 APIs.
Historical Price Data Requests
To create high-precision 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 others.
Data Format: The API should return price data in a standard format such as CSV or JSON.
Historical Price Data API
Here are some popular APIs that offer historical price data for several Ethereum-based assets:
- [CoinGecko API](
- Provides prices, volumes, and market caps for over 10,000 cryptocurrencies, including Ethereum.
- [Cryptocompare API](
- Offers 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 an example 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}"
}
},
x-axis: {
checkmark: {
enabled: 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);
}
}
get historical price data();
Conclusion
With these APIs and sample code snippets, you will be able to retrieve historical price data for multiple Ethereum-based assets. This will allow you to build robust portfolio tracking applications using HighCharts js. Be sure to research the documentation and pricing plans for each API to ensure a seamless integration experience.