Bitcoin Forum
December 12, 2024, 11:55:58 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 »  All
  Print  
Author Topic: Predicting future Bitcoin Price  (Read 10665 times)
bb113 (OP)
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
September 16, 2013, 01:52:13 PM
 #1

How about this method:
1)Get the gox historical daily prices
2)Calculate the day-to-day percent changes, ie (Price[n+1] - Price[n])/Price[n]
3)Create a markov chain starting at the most recent price

4)Sample a price change from the distribution of differences in the historical data (see topright panel below)
5)Update Price by one day in future
6)Goto 4

Example outputs:



Overall Posterior Distributions:


Interpretation:
30 days from today there 95% probability the price will be between 62.5 and 320.7 usd, 67% probability it is between 105.7 and 219.6 USD, and the expected value is either 181 or 169 usd depending on whether you prefer the mean or median as your estimator.
ElectricMucus
Legendary
*
Offline Offline

Activity: 1666
Merit: 1057


Marketing manager - GO MP


View Profile WWW
September 16, 2013, 02:11:00 PM
 #2

Care to backtest it? (That is doing the predictions at a already past point of time so you can see how useful the model is.)
BombaUcigasa
Legendary
*
Offline Offline

Activity: 1442
Merit: 1005



View Profile
September 16, 2013, 02:57:10 PM
 #3

Bro, do you even imgur.com? I can't see your pictures.
bb113 (OP)
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
September 16, 2013, 03:07:38 PM
 #4

Here are the results if I had done this 1 year ago and predicted a year into the future (ie it does not include the price changes after 365 days ago).
The actual prices are noted by the red text:



Bro, do you even imgur.com? I can't see your pictures.
I tried going to that site and it wanted to install something as far as i could tell. This site is just the first one that comes up with a search( "postimg.org"). Not sure why it would not display for you.
oda.krell
Legendary
*
Offline Offline

Activity: 1470
Merit: 1007



View Profile
September 16, 2013, 03:50:45 PM
Last edit: September 16, 2013, 10:50:41 PM by oda.krell
 #5

Really interesting. Thanks for sharing this. By the way, I can see the images fine.

Some notes/observations:

the 95% interval is, hm, sort of useless for our purposes, isn't it? The range is huge (as you would expect), so not much information can be gained from that. Except maybe to tell the uber-bulls that a 100k $/btc price next year is exceedingly unlikely :P

at a glance, the median appears to be more accurate than the mean. What is really puzzling is that in your backtest looking 1 year ahead, a) mean and median diverge a lot (350 vs 149), and b) the meanmedian is actually remarkably accurate. Just a lucky guess, or not, I don't know. But that's a pretty remarkable result for a relatively simple model, no?

Would be interesting to see how the model works in a "sliding" backtest, say: 1 week prediction, starting 1 year ago, moving forward 1 week each iteration. Looking at the result of your backtest, the median might turn out to be a pretty good predictor of the price one week later, which for trading purposes would be already very useful, but it would be *really* interesting to see how the model performs a week before April 10 2013, or a week before one of the other wild price swings in May.

EDIT: wrote 'mean', meant 'median'

Not sure which Bitcoin wallet you should use? Get Electrum!
Electrum is an open-source lightweight client: fast, user friendly, and 100% secure.
Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
BombaUcigasa
Legendary
*
Offline Offline

Activity: 1442
Merit: 1005



View Profile
September 16, 2013, 03:56:55 PM
 #6

I tried going to that site and it wanted to install something as far as i could tell. This site is just the first one that comes up with a search( "postimg.org"). Not sure why it would not display for you.
Sorry to hear that. This is what I see: https://i.imgur.com/dus4hIc.jpg

I can't see the picture in your post: http://s12.postimg.org/8obt1tyij/Gox_Predict001.png, the new url is http://s12.postimg.org/omkirysqj/Gox_Predict001.png for me. It must be an error on your part or some silly protection scheme from postimg.

Here are the results if I had done this 1 year ago and predicted a year into the future (ie it does not include the price changes after 365 days ago).
The actual prices are noted by the red text:

Can you use a logarithmic scale? It's hard to understand what goes on from a flat line and an exponential J curve.
Odalv
Legendary
*
Offline Offline

Activity: 1414
Merit: 1000



View Profile
September 16, 2013, 03:59:50 PM
 #7


Sorry to hear that. This is what I see: https://i.imgur.com/dus4hIc.jpg



I can see the images fine.
bb113 (OP)
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
September 17, 2013, 12:08:05 PM
 #8

With regards to putting more constraints/dependancies, there is a nice linear relationship between the "acceleration of price change" (x axis) and percent chance in price one day later (y-axis):


In the figures above I sampled a change in price putting uniform weights on all, instead we can make some more likely to be chosen (shown by the heatmaps above for the points shown in black). In that case here is a repeat of the first figure:



Now the distribution shown in the heatmap just a normal distribution with standard deviation (.3) which is arbitrary. This appears to be a good skeleton for a model though.


Really interesting. Thanks for sharing this. By the way, I can see the images fine.

Some notes/observations:

the 95% interval is, hm, sort of useless for our purposes, isn't it? The range is huge (as you would expect), so not much information can be gained from that. Except maybe to tell the uber-bulls that a 100k $/btc price next year is exceedingly unlikely Tongue

at a glance, the median appears to be more accurate than the mean. What is really puzzling is that in your backtest looking 1 year ahead, a) mean and median diverge a lot (350 vs 149), and b) the meanmedian is actually remarkably accurate. Just a lucky guess, or not, I don't know. But that's a pretty remarkable result for a relatively simple model, no?

Would be interesting to see how the model works in a "sliding" backtest, say: 1 week prediction, starting 1 year ago, moving forward 1 week each iteration. Looking at the result of your backtest, the median might turn out to be a pretty good predictor of the price one week later, which for trading purposes would be already very useful, but it would be *really* interesting to see how the model performs a week before April 10 2013, or a week before one of the other wild price swings in May.

EDIT: wrote 'mean', meant 'median'

This would be kind of a pain to assess the results of, you think just compare the median with the actual price for the statistic?

I tried going to that site and it wanted to install something as far as i could tell. This site is just the first one that comes up with a search( "postimg.org"). Not sure why it would not display for you.
Sorry to hear that. This is what I see: https://i.imgur.com/dus4hIc.jpg

I can't see the picture in your post: http://s12.postimg.org/8obt1tyij/Gox_Predict001.png, the new url is http://s12.postimg.org/omkirysqj/Gox_Predict001.png for me. It must be an error on your part or some silly protection scheme from postimg.

Here are the results if I had done this 1 year ago and predicted a year into the future (ie it does not include the price changes after 365 days ago).
The actual prices are noted by the red text:

Can you use a logarithmic scale? It's hard to understand what goes on from a flat line and an exponential J curve.
Yes I could do that. There was an annoying technical reason it is not already like that.
bb113 (OP)
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
September 17, 2013, 01:50:05 PM
 #9

And here is 1 year back-testing. The median is not so accurate now but still I think this model is stronger (if it wasnt for the arbitrary standard deviation when assigning the percent change weights). Also the heatmaps in the last post should have had their axes multiplied by 100 to be percents.


bb113 (OP)
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
September 17, 2013, 08:19:21 PM
 #10

OK here are sliding backtest results.

210 days:

Monthly (30 days):

Weekly (7 days):

Daily:
oda.krell
Legendary
*
Offline Offline

Activity: 1470
Merit: 1007



View Profile
September 18, 2013, 03:57:09 PM
 #11

OK here are sliding backtest results.

I admit defeat. How do I read those latest results? Are the "sliding" test results only visible in the upper log chart? If so, how can I compare test result with actual price?

Not sure which Bitcoin wallet you should use? Get Electrum!
Electrum is an open-source lightweight client: fast, user friendly, and 100% secure.
Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
ElectricMucus
Legendary
*
Offline Offline

Activity: 1666
Merit: 1057


Marketing manager - GO MP


View Profile WWW
September 18, 2013, 05:33:11 PM
 #12

It looks like a laggy trend follower to me, not particularly useful.

The black lines in the middle should be the median and the dotted lines the standard deviations.
bb113 (OP)
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
September 18, 2013, 05:37:31 PM
 #13

Those are the results of four different backtests:
1)210 days straight
2) Backtest for 30 days then update the distribution of price changes
3) Backtest for 7 days and do like in #2
4) Backtest one day at a time

Each of them also forecasts for the same time period into the future. I simply appended the results of each backtest on to the last one to create the topleft panels. The actual price data (daily VWAP) is shown by the blue line. The arrows at the bottom of this chart indicate the timepoints at which I plotted the distribution of estimates in the histograms below (just six evenly spaced intervals). The actual prices are indicated on the histograms by the point and blue text if it fell within the 95% HDI, but in red text if it did not for that timepoint.

You can see from the 3rd set of charts (weekly), that it did not perform very well during the large rise and fall. I've since added a further influence on the choice of price change: fit a lowess curve and determine the distance of each price from the curve in the historical data. Then use this correlation to pick a similar price change as occurred historically. Its running in the background now so...
bb113 (OP)
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
September 18, 2013, 05:45:56 PM
 #14

It looks like a laggy trend follower to me, not particularly useful.

The black lines in the middle should be the median and the dotted lines the standard deviations.

Yes, this is to be expected since it is based entirely on historical data. All it can do is give a range of scenarios similar to what has occurred in the past. However, once the basic model is determined, we can add in the influence of a prior distribution on the price change choice (ie make it more likely to choose positive changes if we feel bullish, or negative for bearish), which should improve the forecasting given that the prior used is actually valid. Another thing is to increase the tail risk if for example the price has been "stable too long" or there are lots of black swans sensed.

Basically it will be a way to combine the "this is like 2011/2012/whatever" concept with the subjective impression due to current info on the fundamentals.
oda.krell
Legendary
*
Offline Offline

Activity: 1470
Merit: 1007



View Profile
September 18, 2013, 06:19:47 PM
 #15

Those are the results of four different backtests:
1)210 days straight
2) Backtest for 30 days then update the distribution of price changes
3) Backtest for 7 days and do like in #2
4) Backtest one day at a time

Each of them also forecasts for the same time period into the future. I simply appended the results of each backtest on to the last one to create the topleft panels. The actual price data (daily VWAP) is shown by the blue line. The arrows at the bottom of this chart indicate the timepoints at which I plotted the distribution of estimates in the histograms below (just six evenly spaced intervals). The actual prices are indicated on the histograms by the point and blue text if it fell within the 95% HDI, but in red text if it did not for that timepoint.

You can see from the 3rd set of charts (weekly), that it did not perform very well during the large rise and fall. I've since added a further influence on the choice of price change: fit a lowess curve and determine the distance of each price from the curve in the historical data. Then use this correlation to pick a similar price change as occurred historically. Its running in the background now so...

Still don't get it. I can't see a blue line (for actual price) in the topleft chart. And for test 4), if you backtested one day at a time starting about a year ago, shouldn't there be 365 of the lower histograms, each with a 1 day prediction period?

Not sure which Bitcoin wallet you should use? Get Electrum!
Electrum is an open-source lightweight client: fast, user friendly, and 100% secure.
Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
bb113 (OP)
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
September 18, 2013, 06:34:54 PM
 #16

Blue line is really dark due to image compression, so call it the thick black line that looks like the price history, the chart is getting busy so it may be kind of hard to see... It pretty much goes down the middle of the estimates. It is most obvious in the monthly chart The various colors in the background are the results of a random sampling of the simulation results. The thick grey line is the median estimate, the dotted lines towards the outside are the 67% and 95% HDIs in grey and black respectively. Sometimes they are hard to see now.

The reason there are not 365 histograms is because thats alot of histograms. Instead I chose six at equally spaced intervals, the timepoints that got chose are marked by the triangles at the bottom. You can see the start and end points of the backtesting in the monthly and weekly charts because the estimates are very tight early on then get less certain farther from the start point. The daily graph is high resolution enough that you cant really see this effect.
oda.krell
Legendary
*
Offline Offline

Activity: 1470
Merit: 1007



View Profile
September 18, 2013, 10:38:59 PM
 #17

I see it now. On the daily test I still can't really make out the difference between median and actual price, but I looked at the weekly result zoomed in and it's pretty clear there.

What is interesting is that weekly works quite well as a leading predictor even during volatile times, like the extreme run-up in before the April crash, but it completely fails when it comes to crashes -- the April 10th one, but even slightly less drastic ones, like the one on September 4th. (if I'm reading the chart correctly now)

Sorry if that's stating the obvious, but it's just that the gap is pretty noticeable. The method works well while a trend is continuing, but as it is now, it seems to have no chance to predict a sudden reversal.

Not sure which Bitcoin wallet you should use? Get Electrum!
Electrum is an open-source lightweight client: fast, user friendly, and 100% secure.
Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
bb113 (OP)
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
September 18, 2013, 11:15:31 PM
 #18

I see it now. On the daily test I still can't really make out the difference between median and actual price, but I looked at the weekly result zoomed in and it's pretty clear there.

What is interesting is that weekly works quite well as a leading predictor even during volatile times, like the extreme run-up in before the April crash, but it completely fails when it comes to crashes -- the April 10th one, but even slightly less drastic ones, like the one on September 4th. (if I'm reading the chart correctly now)

Sorry if that's stating the obvious, but it's just that the gap is pretty noticeable. The method works well while a trend is continuing, but as it is now, it seems to have no chance to predict a sudden reversal.


Look at the beta (.5,.5) distribution here:


What I'm thinking is that when things get to the state we were at at the peak, noone really thinks it is going to level off. Either it will keep climbing or crash. So what you do at that point (in lieu of having a good peak indicator) is multiply the probabilities of choosing each price change by that distribution (transform min/max price changes to 0 and 1), thus using your judgement while forecasting to input large kurtosis risk.

Actually I think the beta distribution goes infinite as it approaches zero and one so just pad the limits with .1 or whatever...
btceic
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250


♫ A wave came crashing like a fist to the jaw ♫


View Profile WWW
September 18, 2013, 11:33:10 PM
 #19

Naval Ravikant said its going to $1,000,000 per BTC, start around the 15:00 minute mark for context, but watch the whole thing, it's amazing.

http://techcrunch.com/2013/09/10/disrupt-sf-13-bitcoin-panel/

♫ This situation, which side are you on? Are you getting out? Are you dropping bombs? Have you heard of diplomatic resolve? ♫ How To Run A Cheap Full Bitcoin Node For $19 A Year ♫ If I knew where it was, I would take you there. There’s much more than this. ♫ Track Your Bitcoins Value
oda.krell
Legendary
*
Offline Offline

Activity: 1470
Merit: 1007



View Profile
September 19, 2013, 04:08:27 PM
 #20

I see it now. On the daily test I still can't really make out the difference between median and actual price, but I looked at the weekly result zoomed in and it's pretty clear there.

What is interesting is that weekly works quite well as a leading predictor even during volatile times, like the extreme run-up in before the April crash, but it completely fails when it comes to crashes -- the April 10th one, but even slightly less drastic ones, like the one on September 4th. (if I'm reading the chart correctly now)

Sorry if that's stating the obvious, but it's just that the gap is pretty noticeable. The method works well while a trend is continuing, but as it is now, it seems to have no chance to predict a sudden reversal.


Look at the beta (.5,.5) distribution here:


What I'm thinking is that when things get to the state we were at at the peak, noone really thinks it is going to level off. Either it will keep climbing or crash. So what you do at that point (in lieu of having a good peak indicator) is multiply the probabilities of choosing each price change by that distribution (transform min/max price changes to 0 and 1), thus using your judgement while forecasting to input large kurtosis risk.

Actually I think the beta distribution goes infinite as it approaches zero and one so just pad the limits with .1 or whatever...

Did I mention I don't really know much about statistical methods? So I'll need to ask some dumb questions: that beta distribution is not motivated by anything bitcoin specific, right? You're assuming it is a good representation of peak/reversal likelihoods as a function of extreme price change, correct?. Also, I don't see how you get the actual multiplier that graph. What's the PDF that ranges from 0 to 2.5?

Another idea/question: your random walk approach worked quite okay with price change as input. What do you think are the chances that you can get some complimentary information (maybe estimating reversal likelihood) by applying it to a different domain, say, btc volume, dollar volume, OBV. Not at all sure if that could work, but I'm wondering if price (change) is the only useful input. Any intuition about this?

Not sure which Bitcoin wallet you should use? Get Electrum!
Electrum is an open-source lightweight client: fast, user friendly, and 100% secure.
Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
Pages: [1] 2 3 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!