Skip to content

sdediego/blockchain-api-client

Repository files navigation

blockchain-api-client

Powered by Blockchain

Client written in Python 3 for Blockchain API service:

Features

  • Get Bitcoin blockchain charts data
  • Get Bitcoin blockchain statistical data
  • Get Bitcoin mining pools data

You can also:

  • Persist data via JSON format file pipeline
  • Persist data via MongoDB pipeline
  • Persist data via PostgreSQL pipeline
  • Automatize data fetching with jobs scheduler
  • Deploy to Heroku cloud platform

Getting Started

These instructions will get you a copy of the project on your local system.

Prerequisites

Blockchain API Client uses a number of open source projects to work properly:

And of course Blockchain API Client itself is open source with a public repository on GitHub.

Installation

Quick Start

A step by step series of examples:

Get historical price for Bitcoin in json format

from blockchain.api import BlockchainAPIClient
api = BlockchainAPIClient('charts')
response = api.call(chart='market-price', timespan='all')

Get market capitalization for Bitcoin in json format

from blockchain.api import BlockchainAPIClient
api = BlockchainAPIClient('charts')
response = api.call(chart='market-cap', timespan='all')

Get Bitcoin blockchain statistics in json format

from blockchain.api import BlockchainAPIClient
api = BlockchainAPIClient('stats')
response = api.call()

Get Bitcoin minig pools info in json format

from blockchain.api import BlockchainAPIClient
api = BlockchainAPIClient('pools')
response = api.call(timespan='5days')

Persist data in JSON file

from blockchain.pipelines import JSONFileWriterPipeline
file = JSONFileWriterPipeline.config()
file.write(response)

Persist (save/update) data with MongoDB

from blockchain.pipelines import MongoDBPipeline
mongo = MongoDBPipeline.config()
mongo.open_connection()
mongo.persist_data(response)
mongo.close_connection()

For a complete description of available parameters please check Blockchain API documentation

License

MIT

Free Software, Hell Yeah!