Graph explained


In a medium post of March, 2019, PlanB published a detailed analysis of the co-integration of the market value of bitcoin with the stock-to-flow (S2F) ratio. Based on the same concept, we redid the calculations and added two prediction intervals to the regression line.

Stock-to-flow ratio

The S2F ratio is basically the amount of time (expressed in years) needed at current production rate to double the total stock of a commodity. In the case of Bitcoin, it is easy to compute the S2F because the current production is the amount of new bitcoin generated per block and the total amount of bitcoin is known by examination of all blocks in the public blockchain.

The sources that we used for our analysis are BitInfoCharts for

and AlphaVantage for

Linear regression

Some calculations are needed before performing a linear regression of the data. The actual S2F ratio is calculated for each daily data point. The amount of blocks generated per day is calculated from the average daily block time (in minutes). The total amount of blocks is calculated by summing the daily amounts. Starting at 50 newly generated BTC per block, this amount is halved every 210,000 blocks (approximately every 4 years). The total bitcoin stock can now be calculated by multiplying the amount of BTC per block by the amount of blocks generated and then summing from the first block. The S2F is calculated by dividing the total stock by the currently produced blocks per day.

Now that the total stock of bitcoin is known the total market value can easily be calculated by multiplying with the price per bitcoin in USD.

Before proceeding with the regression, the base 10 logarithm of the S2F and market value is taken. So a S2F of 1 becomes 0 and of 100 becomes 2. A market value of 1,000,000 USD becomes 6 and a market value of 1,000,000,000 USD becomes 9 on the graph.

The log of the market value is now plotted against the S2F for each day where a price is known (from 7/17/2010 based on the data we used). The resulting plot looks like this:

Log market value against log S2F

Prediction intervals

The linear regression line (y = a*x + b) and prediction intervals can easily be calculated in Excel. We chose to add 50% and 80% prediction interval lines because we believe they are useful in determining buy and sell conditions. They are arbitrary though. The plot with the two prediction lines (50% is blue, and 80% is orange) looks like this:

Log market value against log S2F with regression line and prediction intervals

The next step is to calculate the predicted market value for each day by plugging the actual S2F into the newly created model. Before presenting the results in a graph, a 365 day moving average is calculated. This is to smooth out the large fluctuations that sometimes occurs in the daily S2F. We chose to take an average of 183 days before each data point and 183 days after each data point. The final plot now looks like this:

Log market value against time with regression line and prediction intervals

Price in time

The conversion to price is easy. Simply take the market value and divide by the total stock of bitcoin to obtain the price per bitcoin in USD. The graph at the top of this page uses Chart.js to present the data with the Zoom plugin for interaction.


Many thanks to PlanB for the inspiration.

Team Blockslide