Do you want to analyze and plot the data of Bitcoin (BTC), Ethereum (ETH), Cardano (ADA) and other cryptocurrencies but you don’t know where to find a reliable data source? I had the same problem a couple of hours ago when writing a Python script to plot the relative price of altcoins versus BTC. This article is the one I’ve been looking for—and I hope it’ll be helpful to you as well.
Let’s get started with my top data source right away!
CryptoDataDownload.com
This is my preferred data source because it’s updated and very fine-granular data:
- Daily, Hourly, Minute data sets
- Spot and physical market
- CSV format
- Downloadable by Python script
Here’s how they describe their data set:
“We track and produce files for Daily, Hourly, and Minute(!) time series pricing data for the spot/physical market. Each file is easily downloadable in CSV format and can be consumed automatically by Python scripts or other automated processes. In each file, you will find the below/following fields. This OHLC (Open/High/Low/Close) pricing data is updated each day and is taken directly from the exchange(s). Please reach out if you find discrepancies or errors in the data that need to be addressed” (source)
Here are some of their specific data sets from Binance stock exchange. Each link directly leads to the CSV file:
- BTC/USDT [Daily] [Hourly] [Minute] … [Value at Risk]
- ETH/USDT [Daily] [Hourly] [Minute] … [Value at Risk]
- LTC/USDT [Daily] [Hourly] [Minute] … [Value at Risk]
- NEO/USDT [Daily] [Hourly] [Minute]
- BNB/USDT [Daily] [Hourly] [Minute]
- XRP/USDT [Daily] [Hourly] [Minute]
- LINK/USDT [Daily] [Hourly] [Minute]
- EOS/USDT [Daily] [Hourly] [Minute]
- TRX/USDT [Daily] [Hourly] [Minute]
- ETC/USDT [Daily] [Hourly] [Minute]
- XLM/USDT [Daily] [Hourly] [Minute]
- ZEC/USDT [Daily] [Hourly] [Minute]
- ADA/USDT [Daily] [Hourly] [Minute]
- QTUM/USDT [Daily] [Hourly] [Minute]
- DASH/USDT [Daily] [Hourly] [Minute]
- XMR/USDT [Daily] [Hourly] [Minute]
- BTT/USDT [Daily] [Hourly] [Minute]
You can download these CSV data sets in your own Python script using the pandas library:
import pandas as pd # Needed to use unverified SSL import ssl ssl._create_default_https_context = ssl._create_unverified_context # For example: BTC/USD data url = "https://www.cryptodatadownload.com/cdd/Binance_BTCUSDT_d.csv" df = pd.read_csv(url, delimiter=",", skiprows=[0]) print(df)
You can replace the URL field with the custom URL with your data from the list above. The code downloads the BTC/USD historic data that looks like this:
unix date ... Volume USDT tradecount 0 1.622333e+12 2021-05-30 00:00:00 ... 1.690781e+09 965806.0 1 1.622246e+12 2021-05-29 00:00:00 ... 3.949843e+09 2169643.0 2 1.622160e+12 2021-05-28 00:00:00 ... 4.926261e+09 2659178.0 3 1.622074e+12 2021-05-27 00:00:00 ... 3.361414e+09 2102182.0 4 1.621987e+12 2021-05-26 00:00:00 ... 4.113718e+09 2432319.0 ... ... ... ... ... ... 1379 1.503274e+09 2017-08-21 ... 2.770592e+06 NaN 1380 1.503187e+09 2017-08-20 ... 1.915636e+06 NaN 1381 1.503101e+09 2017-08-19 ... 1.508239e+06 NaN 1382 1.503014e+09 2017-08-18 ... 4.994494e+06 NaN 1383 1.502928e+09 2017-08-17 ... 2.812379e+06 NaN [1384 rows x 10 columns]
Feel free to play with this in our interactive Jupyter Notebook here:
The interactive notebook opens in a new tab.
To summarize, the best way to download cryptocurrency data is via this link: https://www.cryptodatadownload.com/data/
CoinMetrics.io
You can also download specific data sets at CoinMetrics.io:
If you want to download, for example, Bitcoin data, you can use the dropdown menu, select “Bitcoin”, and click download like so:
When opening the data set with Excel, it has the following CSV format:
You can download a ZIP file with all data via this link: https://coinmetrics.io/newdata/all.zip. This will download the ZIP file, extract it to obtain the following rich data set:
At the point of this writing, the ZIP file has 113 different data sets for different cryptocurrencies.
However, I haven’t found direct download links that can be used in a Python script—probably, they want to sell the API for a premium price. However, all those data sets can be manually downloaded for free in a safe and secure way.
To summarize, the second best way to download cryptocurrency data is via this link: https://coinmetrics.io/community-network-data/
Other Cryptocurrency Download Links
In various forums, some links are thrown around. I think they’re not as good as the options provided above, but I’ll include them here for comprehensibility as well:
All Cryptocurrencies
Bitcoin
- Coindesk Closing price and OHLC
- Closing price blockchain.info
- Bitcoin data on Quandl
- Bitcoin data on Quandl II
Ether
If you have any additional data sets of interest, and/or you want to improve your Python skills, consider subscribing and send me an email by replying to any of our Python content emails here: