Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: yomi on April 24, 2011, 12:17:59 AM



Title: BTCUSD historical volatility
Post by: yomi on April 24, 2011, 12:17:59 AM
I am starting work on an options trading platform. The first thing I want to calculate is the theoretical pricing of options, for which I need the historical volatility.

I have tried to get historical mtgox closing prices from both

http://bitcoincharts.com/t/trades.csv
and
http://www.bitcoinwatch.com/trades.zip

but both are 404.

Is there any place from where I can download the historical closing prices for mtgox?

Thanks!


Title: Re: BTCUSD historical volatility
Post by: martin on April 24, 2011, 02:50:08 AM
You can pull raw data from my monitor here:

http://bitcointalk.org/index.php?topic=3313.msg90683#msg90683 (http://bitcointalk.org/index.php?topic=3313.msg90683#msg90683)

This has been running for quite a while, pulling minutely data from mtgox (and some other markets). Since mtgox doesn't ever close (afaik) I'm not sure which price you'd want. Maybe take the midday GMT price every day as your day price.

If you specify fetch=N it will only fetch N datapoints, i you do not specify fetch it will fetch the latest 1000 points. I suggest you set fetch=1000, then find the last date in that set, and now fetch=1000&start=YYYY-MM-DD, this way you can page through the data for as long as you like.


Title: Re: BTCUSD historical volatility
Post by: tcatm on April 24, 2011, 01:17:54 PM
I have tried to get historical mtgox closing prices from both

http://bitcoincharts.com/t/trades.csv

You need to specify the symbol you want (e.g. mtgoxUSD in your case):

http://bitcoincharts.com/t/trades.csv?symbol=mtgoxUSD

Also, if you want the complete history you need to set a start timestamp:
http://bitcoincharts.com/t/trades.csv?symbol=mtgoxUSD&start=0


Title: Re: BTCUSD historical volatility
Post by: yomi on April 24, 2011, 05:19:34 PM
Martin, tcam, thanks for the info.

Both are very useful.


Title: Re: BTCUSD historical volatility
Post by: Spurious on June 03, 2011, 10:05:24 PM
I have tried to get historical mtgox closing prices from both

http://bitcoincharts.com/t/trades.csv

You need to specify the symbol you want (e.g. mtgoxUSD in your case):

http://bitcoincharts.com/t/trades.csv?symbol=mtgoxUSD

Also, if you want the complete history you need to set a start timestamp:
http://bitcoincharts.com/t/trades.csv?symbol=mtgoxUSD&start=0

Can you explain to me how I can get them with timestamps? My browser just shows me the the content of a .csv file and I cant really use it.


Title: Re: BTCUSD historical volatility
Post by: k on June 03, 2011, 10:14:12 PM
i think the time is unix time. [edit: originally said UTC but meant to say unix time]

you can convert it into a more human readable form if you use a formula like this in Excel (where A2 is the UTC cell)
 
=DATE(1970,1,1+(A2/(60*60*24)))+TIME(MOD(INT(A2/3600),24),MOD(INT(A2/60),60),MOD(A2,60))

that'll give you day/month/year hour:min

you can use just

=DATE(1970,1,1+(A2/(60*60*24)))

to get day/month/year

hope that helps


Title: Re: BTCUSD historical volatility
Post by: Spurious on June 03, 2011, 10:23:08 PM
I havent downloaded it, because I cant download it in .csv format, it just shows me a HTML page with all the values and I look at it and say wtf.


Title: Re: BTCUSD historical volatility
Post by: k on June 03, 2011, 10:26:01 PM
in your browser there should be something like save page as. save it as a .csv or .txt  and then import it into Excel or whatever you want to use


Title: Re: BTCUSD historical volatility
Post by: Spurious on June 03, 2011, 10:32:03 PM
Idiot me.

1282038389,0.06300000,100.00000000

Ok, I misunderstood sth.

Ok, first one is time and I used the excel formula above and it didnt work for time only date.

=DATE(1970;1;1+(A3/(60*60*24)))+TIME(MOD(INT(A3/3600);24);MOD(INT(A3/60);60);MOD(A3;60))

Is this correct? I had to replace , with ;


Title: Re: BTCUSD historical volatility
Post by: k on June 03, 2011, 10:38:27 PM
it's time, price, amount

the time is unix (epoch) time (not sure if there is a difference or just different names for the same thing)

1282038389 = Tue, 17 Aug 2010 09:46:29 GMT

see http://www.epochconverter.com/ (http://www.epochconverter.com/)

or use the formula I gave above in a spreadsheet.


Title: Re: BTCUSD historical volatility
Post by: Spurious on June 03, 2011, 10:45:16 PM
Your formula doesnt work for an unknown reason and I dont get why.

Edit: I split it between two columns and it works now.


Title: Re: BTCUSD historical volatility
Post by: k on June 03, 2011, 11:01:57 PM
try formatting the cell, custom format.

https://i.imgur.com/uXeef.png


Title: Re: BTCUSD historical volatility
Post by: Spurious on June 04, 2011, 12:57:10 AM
So, I calculated the standard deviations of logarithmic changes (ln(Price(n)/Price(n-1)) and multiplied by square root of sample to get annualized standard dev.

Total: 26.77807002
Since April 1st: 7.344956362


Are those numbers reasonable?


Title: Re: BTCUSD historical volatility
Post by: toffoo on August 02, 2011, 09:41:10 PM
Yup, I'm not really sure how one would calculate annualized volatility on something that is continuously traded (tick data) 24h/7d.  I've only ever done it on daily closes and annualized it using 252ish trading days / year.

I think I started thinking about it for Bitcoins at some point, got to about where you are now, and never really figured it out.

Could somebody who really knows what they're doing explain how to do this?


Title: Re: BTCUSD historical volatility
Post by: Fireball on August 02, 2011, 10:21:05 PM
Yup, I'm not really sure how one would calculate annualized volatility on something that is continuously traded (tick data) 24h/7d.  I've only ever done it on daily closes and annualized it using 252ish trading days / year.

I think I started thinking about it for Bitcoins at some point, got to about where you are now, and never really figured it out.

Could somebody who really knows what they're doing explain how to do this?

Just set up a point in time and consider it as a day close. Same happens when going down - e.g. make hourly data from tick data: we just take hour's close as being 59 minutes 59 seconds, and next hour 0 minutes 0 seconds is the opening of a new hour (depends though, it might be that 0"0' would be hour's close and 0"1' would be opening of a new hour, would need to check in my app).