Skip to main content

Glassnode Python API

Glassnode API client for python.

Disclaimer

This is a non-official python client for the Glassnode API. I am in no way affiliated, associated, authorized, endorsed by, or in any way officially connected with Glassnode, or any of its subsidiaries or its affiliates. The name Glassnode as well as related names, marks, emblems and images are registered trademarks of their respective owners.

Overview

This is a very simple and intuitive library for accessing the Glassnode API.

Quick Start

To start using the library, first install the package.

pip install glassnode

Then, just instanciate the GlassnodeClient providing your API key and start making requests. Here's a code sample that demonstrates how to get the full history of BTC addresses count.

from glassnode import GlassnodeClient

api_key = ""
client = GlassnodeClient(api_key)
data = client.get("addresses", "count", {"a": "BTC"})

How to make requests

In order to request any metric, just call the get method on the GlassnodeClient instance passing the following parameters:

  • domain: the metric's domain.
  • metric: the metric name.
  • params: the dict of the query parameters to pass along to the request.

The difference between domain and metric is actually very simple. Glassnode has designed it's API in a very modular and intuitive way, grouping metrics by domain. All metrics endpoints follow this pattern: https://api.glassnode.com/v1/metrics/{domain}/{metric}. For a complete list of domains, metrics and params, see their official API docs (https://docs.glassnode.com).

Here's another example. This time we'll use the client to get both the STH and LTH NUPL for the market cycle from the 2016 halving to the 2020 halving, with a 24h resolution.

from  glassnode  import  GlassnodeClient

api_key = ""

client = GlassnodeClient(api_key)
since = 1589148000 # July 9 2016
until = 1468015200 # May 11 2020
resolution = "24h"
params = {"a": "BTC", "s": since, "u": until, "i": resolution}

sth_nupl = client.get("indicators", "nupl_less_155", params)
lth_nupl = client.get("indicators", "nupl_more_155", params)

Release files for glassnode 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glassnode 0.0.2
File Size Uploaded
glassnode-0.0.2.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for glassnode 0.0.2
File Interpreter ABI Platform
glassnode-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / glassnode-0.0.2.tar.gz

Download URL glassnode-0.0.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
25cd2aafa153976905568adf38eb6464a4e7a255bbb659f257be3b821b4f0176
BLAKE2b-256 checksum
How to use checksums
88a57d52d1f20c54f3293cebf56a9ff620c30c1439e432e083a20d6ec6ea8deb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release files / glassnode-0.0.2-py3-none-any.whl

Download URL glassnode-0.0.2-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
320a3e61227506977284b301670ba36d4a55e3c7b1c1cd324a18536aa7ffb4f8
BLAKE2b-256 checksum
How to use checksums
ae80edb90a3fb15d365c698048b5f3ed033f8c7fe16408c28276c265ae6e7ca0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page