I started bitcoin mining with my Raspberry Pi and an ASIC miner, just for fun because I like to tinker. I doubt that I’ll get rich off this, but I just wanted to try out this “real” digital currency.

I’m not 100% sold on it yet, it does have some great advantages (i.e. decentralized, low transaction fees), and some disadvantages (i.e. governments might not like it), so it remains to be seen if it will be viable.

In the meantime, I’m mining 24/7 with a goal to get to 1 BTC by the time I’m 90.

Ugly over at Uglychart.com just posted a link about research that sentiment mined over 10 million tweets from 2008 and was able to predict daily market behavior to an accuracy of 87.6%. While the post is vastly interesting from a text & sentiment mining perspective using social media, and the application of it to the stock market, I’m not 100% convinced its very viable.

Why? Well I tend to echo some of the comments left by readers at the bottom of the original post. For example, once this“edge” is discovered by general market participants, it tends to get discounted and the edge goes away. So what we read here today is probably already discounted by the market and is just routine“business as usual.”

Now, I certainly don’t mean we should abandon text & sentiment mining for the markets, but rather we should continue to use these tools to develop our own secret edges and evolve them as the market changes. Follow the advice of poker players and underarm deodorant manufacturers, never show your hand and never let them see you sweat.

Hi there! This is one my most popular posts and I would love it if you became an RSS Reader!

The inspiration for my S&P500 Volatility Timing model came from rereading portions of Mandelbrot’s book, The (Mis)Behavior of Markets, and trolling around the Internet for Nassim Taleb’s research work on risk. I think both guys push the envelope on truly understanding unseen risk and those pesky financial asteroids. Since my model is currently being developed, I thought it would be worth my while to truly learn and understand how historical volatility (HV) is calculated. I first searched the Internet for any free data downloads of HV but came across several pay for data download sites.

One of them, iVolatility.com, seemed to have comprehensive data but it was expensive. One year’s worth of HV for one asset price would’ve cost me $5! So what does any engineering type person do in the face of expensive solutions? He (or she) build’s their own cheaper solution. I decided to calculate HV on my own after reading about it on wikipedia. Now, I’m submitting this analysis for peer review as I’m treading in unfamiliar waters. Please feel free to correct me if my computations or understanding of the material is wrong.

Wikipedia defines HV as:

The annualized volatility Ïƒ is the standard deviation Ïƒ of the instrument’s logarithmic returns in a year.

Furthermore,

The generalized volatility Ïƒ_{T} for time horizon T in years is expressed as:

sigma_T = sigma sqrt{T}.

Note: There’s a flaw in the Wikipedia’s formula logic after the generalized volatility formula above as pointed out by C++ Trader (thanks for the catch). Please see the related links below for more information on the correct calculation of HV.

Note that the formula used to annualize returns is not deterministic, but is an extrapolation valid for a random walk process whose steps have finite variance.

So the first step is to calculate the S&P500′s logarithmic returns for a year. I’ll be using the weekly time series and I’ll analyze it in a handy Excel spreadsheet here: HV Example.xls

Once again I’ll turn to wikipedia for an explanation of logarithmic returns:

Academics use in their research natural log return called logarithmic return or continuously compounded return. The continuously compounded return is asymmetric thus clearly indicating that positive and negative percent returns are not equal. A 10% return results in 9.53% continuously compounded return while a -10% results in -10.53%. This clearly indicates that the investment will result in a dollar amount loss corresponding to the difference between the absolute values of the two numbers: 1% (this is an approximate equality).

V_{i} is the initial investment value

V_{f} is the final investment value

ROI_{Log} = lnleft(frac{V_f}{V_i}right).

ROI_{Log} > 0 is profit

ROI_{Log} < 0 is a loss

Doubling occurs when ROI_{Log}=ln(2)=69.3%

Total loss occurs when ROI_{Log}to-infty.

This should be straightforward and I will calculate the weekly ROI for the S&P500. Why? Well I’m interested in calculating weekly HV so my V_{i }will be the week(1)’s closing price and Vf will be week(2)’s closing price. For the next iteration V_{i }will be the week(2)’s closing price and Vf will be week(3)’s closing price and so forth.

Next I created an Excel Macro that would calculate the natural log and simultaneously calculate the HV for 10, 20, and 30 days using the standard deviation of the daily logarithmic returns multiplied by 252 (see related links below).

There you have it, your very own weekly HV! Feel free to download the Excel macro and play with it. By all means, please critique my analysis and let me know if my logic is flawed! The more I learn about this, the more my ATS takes shape!

Update: The Excel Macro matches the output from iVolatility.com for the 10, 20, and 30 day HV’s. Check!