Monday, June 27, 2011

Option Volatility Part 3

Now we are ready to look at the source code. I will once again post it to the usual place making it accessible to all. However, you will notice that this is the LITE version posted. If you are interested in a more efficient and user friendly version, then you can email me and I will send the PRO version to you for $3. The main difference in the PRO version is the more user-friendly graphical user interface. It is also more dynamic than the LITE version in the sense that will handle more of the work for you. I will point out the differences as we go through the source code. Also, one major advantage and distinction between the PRO and LITE version is that the PRO version will use the Black_Scholes model to calculate a "fair" option premium. Whereas, the lite version renders a buy or sell decision purely based on volatility. Lastly, the PRO version takes Gamma and Theta into account, while the Lite version does not. This means that the Lite version produces a very theoretical option premium and represents a snapshot in time.

Firstly, here it is: optionVolatilityLite.py .

We are going to do this analysis on an August 2011 340 Call .

When the program is first run, it produces the following GUI:
Notice that the entry fields are white, while the output fields are not able to be edited (grayed out).
Step 1: Select the file containing the closing price data for the stock you wish to analyze. (Similar to the pair trading program)
Step 2: Enter in the current price of the stock. (Pro version does this for you.)
Step 3: Enter in the strike price, days to expiration, call or put, option premium, implied volatility, delta, and vega values for the option you want to analyze. All of these values will be provided to you by your brokerage.

Now we will look at how that information is entered, using an August 2011 340 Call. The GUI will now look like this after you have entered in the appropriate information:
Notice that the Implied Volatility is entered in in decimal format. It will be given to you in a format such as 26.4%, but you will enter it in as .264. Also, you must type in, exactly, "Call" or "Put". After the information is entered, we are ready to press the "Compute Results" button.




After pressing the button, the GUI will now look like this:
The program will then calculate the Historical Volatility based on the text file full of closing prices for the most recent 30 days. If that calculated value is greater than the Implied Volatility you listed, then it will render a "Buy" decision. (If less than implied volatility, a "Sell" decision) It will then calculate a one standard deviation range of stock prices based on the current implied volatility and the number of days to expiration. Next, it will calculate the necessary volatility change to hit the upper or lower bound of the standard deviation range (depending on whether you are Buying/Selling a Call/Put.) Lastly, it will calculate a new theoretical premium for hitting the optimal bound (again, lower or upper bound depending on whether you are Buying or Selling, and whether it is a Call or Put) and the profit associated with that new premium.

Please look through the source code that I linked to and email me your questions. Also, if you would like to inquire about purchasing the PRO version email me, and it will be available through pay-pal.

No comments:

Post a Comment