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

class BlockchainBitcoinMetadataAlgorithm(QCAlgorithm):
    
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)   # Set Start Date
        self.SetEndDate(2020, 12, 31)    # Set End Date
        self.SetCash(100000)

        self.btcusd = self.AddCrypto("BTCUSD", Resolution.Minute).Symbol
        ### Requesting data
        self.bitcoin_metadata_symbol = self.AddData(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")

        self.last_demand_supply = None

    def OnData(self, slice: Slice) -> None:
        ### Retrieving data
        data = slice.Get(BitcoinMetadata)
        
        if self.bitcoin_metadata_symbol in data and data[self.bitcoin_metadata_symbol] != None:
            current_demand_supply = data[self.bitcoin_metadata_symbol].NumberofTransactions / data[self.bitcoin_metadata_symbol].HashRate

            # comparing the average transaction-to-hash-rate ratio changes, we will buy bitcoin or hold cash
            if self.last_demand_supply != None and current_demand_supply > self.last_demand_supply:
                self.SetHoldings(self.btcusd, 1)
            else:
                self.SetHoldings(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: