API Docs
Python Client

Luxor-HashrateIndex Python Library and Command Line GraphQL API Client

We've decided to open-source our datasets for the community to build features, perform research and bring even more transparency to the Bitcoin mining industry.

Feel free to send your projects or questions our way to [email protected] or @hashrateindex on Twitter. Looking forward to see what y'all build!

Get Started

First, you'll need the GitHub repo, you can find it here (opens in a new tab).

To get started, you will need the following basic information:

  • Endpoint: https://api.hashrateindex.com/graphql
  • API Key: Reach out to [email protected] to get an API Key.

Code Snippet

from hashrateindex import API
from resolvers import RESOLVERS
 
API = API(host = 'https://api.hashrateindex.com/graphql', method = 'POST', key = 'KEY')
RESOLVERS = RESOLVERS(df = False)
 
resp = API.method(parameters)
resolved = RESOLVERS.method(resp)

Command Line Usage

To get started and get params help run:

python hashrateindex.py -h

Result:

Options:
  -h, --help
  -e HOST, --endpoint=HOST
  -k KEY, --key=KEY
  -m METHOD, --method=METHOD
  -f FUNCTION, --function=FUNCTION
  -q QUERY, --method=QUERY
  -p PARAMS, --params=PARAMS
  -d DF, --df=DF

Example usage:

python3 hashrateindex.py -k KEY -f get_bitcoin_overview
python3 hashrateindex.py -k KEY -f get_hashprice -p "_1_DAY",BTC
python3 hashrateindex.py -k KEY -f get_network_hashrate -p "_3_MONTHS"
python3 hashrateindex.py -k KEY -f get_network_difficulty -p "_3_MONTHS"
python3 hashrateindex.py -k KEY -f get_ohlc_prices -p "_3_MONTHS"
python3 hashrateindex.py -k KEY -f get_asic_price_index -p "_3_MONTHS",BTC