Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Using Bitcoin Market Activity as a Trading Signal

Can Bitcoin transaction activity predict stock prices?

It's an interesting question, especially considering the infamous volatility of Bitcoin exchange rates. But perhaps market transactions are more telling, and activity in the real world equates to activity online.

I took data from http://blockchain.info/charts, specifically the historical data on the number of transactions since the inception of Bitcoin. The .csv file required some modification as well. You can see the file I used here: http://pastebin.com/raw.php?i=6qbLE4gi

My algorithm is pretty basic. On any given day, I calculate the average of the past three days of transaction activity. If Bitcoin market activity is greater than this three-day average, I buy; otherwise, I sell. I also fluctuate the amount ordered a bit based on the magnitude of the change; perhaps a bigger increase in Bitcoin market activity is associated with a bigger increase in stock price. I start from September 2009, when Bitcoin market activity truly begins to stabilize (relatively, since speaking of stability and Bitcoin is an oxymoron).

This is my first algorithm, so if you have any suggestions or improvements, I'd love to hear, and feel free to mess around with it. One thing I'd like to know is whether my algorithm avoids the common time travel issue.

3 responses

Jesse,

Nice algo - thanks for sharing. When I first looked at this I was assuming you were looking at traded volume, but see its # of transactions. It might be cool to extend this and check out some of the other data series from that site, like the ratio of trade volume to number of transactions perhaps (http://blockchain.info/charts/tx-trade-ratio).

I'm also trying to recall if anyone's looked at correlations between bitcoin volatility and standard volatility indices like the VIX - that could be interesting as well. One of my (many) concerns about looking for signals in Bitcoin data would be making any assumptions about how stationary you could expect the dynamics of the time series to be. Sure it's crazy volatile, but what's the autocorrelation on that volatility over time?

Anyway - I like the idea - nice work!
Jess

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hi Jess,

Great ideas. For starters, here's the same algorithm with the trade ratio data which you can find a modified csv of here: http://pastebin.com/raw.php?i=nMMJBbHP

The data goes back to 2010-8-17. This one didn't do as well, although I'm sure there are some optimizations that can be made.

Hey Jesse,
Thanks for posting!! This is great! So I'm a student who can't program, but I'm interested in trading and love this website. I have a Behavioral Finance final due on Friday I'd like to use something like this for that class, but was hoping to use the idea that bitcoin would be good for momentum trading as it is purely sentiment based not value-based. Is there any way to add a simple momentum formula to your algorithm?
I was thinking a Moving Average like https://www.quantopian.com/posts/ma-crossover would be great. However, I cant program it :(
When I try i get: "CParserError: Error tokenizing data. C error: Expected 1 fields in line 27, saw 2, There was a runtime error on line 13."
Can one of you guys help out?
Thanks!!
JD