A tool for generating a data set of bitcoin exchange rates by block height rather than date
This script takes historical bitcoin exchange rate data and matches it with bitcoin block timestamps to produce a CSV of the approximate exchange rate at a given block height.
There are several sources of historical data that are ingested by the script.
- The Bitcoin exchange rate is presumed to be 0 from January 3 2009 to October 5 2009.
- For October 5 2009 through April 24 2010, New Liberty Standard rates via http://newlibertystandard.wikifoundry.com/page/2009+Exchange+Rate
- For April 25 2010 - July 31 2010, bitcoinmarket_history.csv courtesy of casebitcoin.com
- For August 1 2010 - April 30 2013, MTGOX history via bitcoincharts.com
- For May 1 2013 - present, Bitstamp history via bitcoincharts.com
- A locally running Bitcoin node with RPC access enabled
- PHP 7.2 or later
- php-curl
- Install composer: https://getcomposer.org/download/
- Install JSON-RPC client
php composer.phar require denpa/php-bitcoinrpc
php composer.phar install
- Set your RPC credentials on line 7 of the generateBlockHeightExchangeRates script
- Run the generation script
php generateBlockHeightExchangeRates.php > block_height_exchange_rates.csv &
If you don't want to run this generation script yourself, you can find the most recently generated data set here.