Other Utility Classes

Exchange Rates

We provide a utility class that retrieves exchange rates from Coindesk’s Bitcoin Price Index and provides conversions between bitcoin and your currency of choice.

class blocksci.currency.CurrencyConverter(currency='USD', start=datetime.date(2009, 1, 3), end=datetime.date(2020, 11, 12))[source]

Imports Bitcoin exchange rates in a variety of currencies using the Coindesk API available at https://www.coindesk.com/price/.

bitcoin_to_currency(value, date)[source]
btc_to_currency(value, date)[source]
currency_to_bitcoin(value, date)[source]
currency_to_btc(value, date)[source]
currency_to_satoshi(value, date)[source]
exchangerate(date)[source]
satoshi_to_currency(value, date)[source]
satoshi_to_currency_df(df, chain, columns=None)[source]

Custom Pickler

BlockSci objects cannot be pickled by Python’s standard pickle library. Instead, we provide a custom pickler for BlockSci objects that allows to serialize them.

class blocksci.pickler.Pickler(file, protocol=None, fix_imports=True, buffer_callback=None)[source]

Custom Pickler for BlockSci objects

class blocksci.pickler.Unpickler(file, chain)[source]

Custom Unpickler for BlockSci objects

Ranges and Iterators

This section contains various ranges and iterators not described elsewhere.