Extracting Periodicity from Cryptocurrency Prices (bitcoin data power spectrum)

If you take a look at a picture like this,

RpuwrgJ

there is some pretty obvious linear impulse response there. Usually, the greater resolution you use, the more frequencies you see. The prices of real currency pairs are often fractal like – as evidenced by the twitter account of Ed Matts @EdMatts (highly recommend). The only difference is the EUR/USD or pair doesn’t experience massive shocks like cryptos do. So here that periodicity really shines.

This is a follow up on a post I made doing a log linear fit for “predicting the future” bitcoin price.  This example uses the same data set of 893 daily weighted price values from September 13, 2011 to February 20, 2014.

The question: is there any significant periodicity in the bitcoin price data?  I took the power spectrum and the result is as follows.  The x-axis is days, and the y-axis represents arbitrary units for “strength” of periodic trend.  There is insufficient data to resolve any low frequency peaks…but there appear to be relevant peaks in bins 167 and 175, indicating there may be “natural cycles” for the bitcoin price.

Take none of this seriously, and enjoy the data please. Raw data (pastebin) http://pastebin.com/YntGdH9t

Image

I used Mathematica to create this, but you can do it in excel; see footnote.

Github repo: https://github.com/Altoidnerd/Spectra

I pasted the 893 numbers into input[1] in a notebook, and Mathematica automatically labeled each entry as Out[1], Out[2], …

Then I did

Price = Table[Out[k], {k, 1, 893}];
FFTPrice = Abs[Fourier[Price]]^2;
Length[FFTPrice]

returned

893

Then drop half of it (it’s symmetrical and half is a copy…useless)

FFTHALF = Drop[FFTPrice, -446];
ListLinePlot[FFTHALF, ImageSize -> 1400, PlotRange -> {0, 12000}]
Donations: 13xdMqkaVKkHKT3ZZx5ikAvQUEkzqpDkDb

ALTOIDNERD 2014 

Note about excel: You can use excel to take fourier transforms, as long as your data has a length that is a power of two.  Your data will in general not have appropriate length, but you can just add zeros until it does.  It’s called zero-padding….it actually helps make the peaks clearer and doesn’t harm your data set in any way.  Peace.

2 thoughts on “Extracting Periodicity from Cryptocurrency Prices (bitcoin data power spectrum)”

Leave a Reply

Your email address will not be published. Required fields are marked *