Blockchain
Bitcoin Metadata
Introduction
The Bitcoin Metadata dataset by Blockchain provides 23 fundamental metadata of Bitcoin directly fetched from the Bitcoin blockchain. The data starts in January 2009 and delivered on a daily frequency. This dataset contains mining statistics like hash rate and miner revenue; transaction metadata like transaction per block, transaction fee, and number of addresses; and blockchain metadata like blockchain size and block size.
For more information about the Bitcoin Metadata dataset, including CLI commands and pricing, see the dataset listing.
About the Provider
Blockchain is a website that publishes data related to Bitcoin. It has been online since 2011 and publishes the Bitcoin Metadata history back to 2009.
Example Applications
The Bitcoin Metadata dataset enables you to incorporate metadata from the Bitcoin blockchain into your strategies. Examples include the following strategies:
- Comparing mining and transaction statistics to provide insight on the supply-demand relationship of the Bitcoin blockchain service.
- Measuring the activity and popularity of the Bitcoin blockchain to predict the price movements of the Cryptocurrency.
For more example algorithms, see Examples.
Requesting Data
To add Bitcoin Metadata data to your algorithm, call the add_data
method with the BTCUSD Symbol
. Save a reference to the dataset Symbol
so you can access the data later in your algorithm.
class BlockchainBitcoinMetadataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2019, 1, 1) self.set_end_date(2020, 6, 1) self.set_cash(100000) self.btcusd = self.add_crypto("BTCUSD", Resolution.DAILY, Market.BITFINEX).symbol self.dataset_symbol = self.add_data(BitcoinMetadata, self.btcusd).symbol
Accessing Data
To get the current Bitcoin Metadata data, index the current Slice
with the dataset Symbol
. Slice objects deliver unique events to your algorithm as they happen, but the Slice
may not contain data for your dataset at every time step. To avoid issues, check if the Slice
contains the data you want before you index it.
def on_data(self, slice: Slice) -> None: if slice.contains_key(self.dataset_symbol): data_point = slice[self.dataset_symbol] self.log(f"{self.dataset_symbol} miner revenue at {slice.time}: {data_point.miners_revenue}")
To iterate through all of the dataset objects in the current Slice
, call the get
method.
def on_data(self, slice: Slice) -> None: for dataset_symbol, data_point in slice.get(BlockchainBitcoinData).items(): self.log(f"{dataset_symbol} miner revenue at {slice.time}: {data_point.miners_revenue}")
Historical Data
To get historical Bitcoin Metadata data, call the history
method with the dataset Symbol
. If there is no data in the period you request, the history result is empty.
# DataFrame history_df = self.history(self.dataset_symbol, 100, Resolution.DAILY) # Dataset objects history_bars = self.history[BlockchainBitcoinData](self.dataset_symbol, 100, Resolution.DAILY)
For more information about historical data, see History Requests.
Example Applications
The Bitcoin Metadata dataset enables you to incorporate metadata from the Bitcoin blockchain into your strategies. Examples include the following strategies:
- Comparing mining and transaction statistics to provide insight on the supply-demand relationship of the Bitcoin blockchain service.
- Measuring the activity and popularity of the Bitcoin blockchain to predict the price movements of the Cryptocurrency.
For more example algorithms, see Examples.