Glassnode API Tutorial with Python
One of the biggest concerns facing cryptocurrency investors at the moment is that prices are highly volatile due to the number of factors that can influence them. It is not uncommon to see massive fluctuations within a single day, or in some instances even just a few hours.
For those who are new to the crypto-space, Glassnode is an excellent resource for on-chain analytics and intelligence. It offers a wide range of products and resources allowing users to gain visibility into what is happening on the blockchain for many different crypto assets.
As a current Data Science student, I find their API to be a super helpful tool for on-chain insights. It offers a wide-range of historical data on metrics such as the number of active wallet addresses, circulating supply, as well as the balance of assets being held on exchanges just to name a few.
I wanted to provide a quick guide on how to use their API to allow users the ability to conduct their own analysis on cryptocurrencies using Python as outlined below.
Step 1:
First, head over to Glassnode.com and set up an account. Once you are ready, click the dropdown menu and select API.
Step 2:
Once you reach the API page, click on the Generate Key button and your API key will be generated. Next, copy down your API key and make sure to store it in a safe place.
Step 3:
Click on the View API Documentation button to navigate to the next page which includes additional resources as well as links to Glassnode’s social media pages.
Step 4:
Open up a Jupyter Notebook and import the following libraries in order to be able to conduct your API call.
Step 5:
Once your libraries are loaded, the next step is to assign a variable for your API key from Step 1.
Step 6:
Next, create a list of the endpoints you would like to explore and assign them to a variable such as the example below.
Step 7:
After the variable for the endpoints has been assigned, the next step is to create a new variable as an empty list, and run a list comprehension through each of the endpoints to be stored as a new list of data frames. Please see the below as an example:
Step 8:
Last but not least, create a new variable which concatenates the results of each API endpoint into a single data frame to use for your modeling and analysis.
Once finished, your data frame should end up looking something like this:
I hope this was helpful, good luck with your analysis!