About Bitcoin Metadata

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.


About Blockchain

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.


About QuantConnect

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.


Algorithm Example

from AlgorithmImports import *
from QuantConnect.DataSource import *

class BlockchainBitcoinMetadataAlgorithm(QCAlgorithm):
    
    def initialize(self) -> None:
        self.set_start_date(2019, 1, 1)   # Set Start Date
        self.set_end_date(2020, 12, 31)    # Set End Date
        self.set_cash(100000)

        # Request BTCUSD as the trading vehicle on Bitcoin Metadata
        self.btcusd = self.add_crypto("BTCUSD", Resolution.MINUTE).symbol
        # Request Bitcoin Metadata for trade signal generation
        self.bitcoin_metadata_symbol = self.add_data(BitcoinMetadata, self.btcusd).symbol

        # Historical data
        history = self.history(BitcoinMetadata, self.bitcoin_metadata_symbol, 60, Resolution.DAILY)
        self.debug(f"We got {len(history)} items from our history request for {self.btcusd} Blockchain Bitcoin Metadata")

        # Cache the last supply-demand ratio for comparison
        self.last_demand_supply = None

    def on_data(self, slice: Slice) -> None:
        # Trade only based on updated Bitcoin Metadata
        data = slice.get(BitcoinMetadata)
        
        if self.bitcoin_metadata_symbol in data and data[self.bitcoin_metadata_symbol] != None:
            # Calculate the supply-demand ratio to estimate the microeconomy structure of Bitcoin for scalp-trading
            # Transaction number as demand, hash production rate as supply
            current_demand_supply = data[self.bitcoin_metadata_symbol].numberof_transactions / data[self.bitcoin_metadata_symbol].hash_rate

            # Comparing the average transaction-to-hash-rate ratio changes, buy Bitcoin if demand is higher than supply, sell vice versa
            if self.last_demand_supply != None and current_demand_supply > self.last_demand_supply:
                self.set_holdings(self.btcusd, 1)
            else:
                self.set_holdings(self.btcusd, 0)

            self.last_demand_supply = current_demand_supply

Example Applications

The Bitcoin Metadata dataset enables you to incorporate metadata from the Bitcoin blockchain into your strategies. Examples include the following strategies: