This guide is beginning with the Cryptocurrency prices obtaining into the Python:
– End-of-Day
– Intraday
– Real-time
directly into the Python’s environment.
If you want to learn how to install the EODHD APIs Python Financial Official Library and activate your API key, I recommend to start with exploring of our Documentation for it.
After preparing the Library for the work, the following command will retrieve a list of exchanges.
df_exchanges = api.get_exchanges()
I would normally use VSCode, but I decided to use Google Colab for this (screenshot above).
I’ve designed the library to return Pandas dataframes. This is really handy as it makes it really simple to filter. For example if I want to search for the Code for Cryptocurrencies, I can do this.
I now want to retrieve the symbols for the Cryptocurrency exchanges.
As you can see, there are 3014 cryptocurrencies available.
I am able to retrieve intraday and interday historical data using the same function. EODHD APIs has separate queries for this but I simplified it by combining them.
1m, 5m, and 1h intraday data is available.
I also included websocket support in the library.
from eodhd import WebSocketClient
Instead of individual API calls to EODHD APIs, you can open a websocket which allows you to stream the data real-time.
websocket = WebSocketClient(
api_key="<Your_API_Key>",
endpoint="crypto",
symbols=["BTC-USD"]
)
websocket.start()
Once the websocket is running you can print the data. I imported “sleep” from the “time” library to slow down the display, as the amount of data being retrieved can overwhelm processing.
As EODHD APIs release new features and functionality, I will include it in the library. If I have missed anything, let me know and I’ll add it.
Now you know how to obtain End-of-Day, Intraday and Real-time the prices for any Cryptocurrency directly into the Python environment.
If you want to learn how to do the Technical Analysis with the EODHD APIs Python Financial Official Library, I recommend to explore my next Article “Stocks Market Technical Analysis with EODHD Financial APIs Python Financial Library” .