Quote from uncleTom: Ok. SO what you're saying is that I could use the 365 although my volatility and therefore theoretical option prices would be different? Just pick whether you want greeks computed per trading day or per calendar day. In other words, if you compute the volatility and time remaining per 365 days, you'll get theta per calendar day, for example. Option pricing won't make much of a difference no matter which you use, although you'll get some quantum jumps on Fridays and Mondays if you use calendar pricing. Did you see that I was lost on the volatility days? Isn't really the length of the close array, closeData.length? See page #3 of these posts--it's a constant representing the number of lookback days to compute the volatility over. 20 trading days is a frequently used number. the method call dfc.getCloseData()? Is that the way you open the file with closing prices? The method returns an array of closing prices.
Thanks for the info . . . looks good. Don't get me wrong, i may have overlooked this, but I don't see where volatilitydays was ever declared. Let me know if my head's in the sand. I want to post something when I get done.
FullyArticulate: How do I use this code and make it something. I pasted it into front page to see what it does and nothing happened. I am obviously not very tech savvy.
You'd need to use a Java development environment and create the functions to call the code I posted. In other words, you'd need to do quite a bit of work. You can do something similar with Excel (or Open Office's Calc). If you can get closing data into your spreadsheet, you can fill out the formulas to compute the log difference, then the mean, then the standard deviation to get the volatility. If you're just looking for an option price calculator, try: http://www.cboe.com/LearnCenter/software.aspx or http://www.cboe.com/LearnCenter/OptionCalculator.aspx
Yeah this program looks like it's used on very large amounts of data and is more than likely just part of a project that does something more complex such as real time option pricing or maybe perhaps some kind of automated arbing??? FA, You never told us where/how you declared the volatilitydays variable. Many THanks for all your help up to this point.
What is the difference between all the work you are doing as opposed to use the CBOE? There must be a reason you would go thru the trouble. What can I use that is Java whatever? heheh
I just left out the line because it's at the top of the class rather than in the function. The line is: private static final int volatilityDays = 20;
The HV code I posted is part of a larger group of code which looks at volatility over time. So, it computes HV, but it also computes a weighted-average IV so I can analyze their relationship over time. Still, my tool does a lot of other nice stuff: 1) Open position management with realtime greek computations for the entire portfolio (i.e. I generally want to hold a pretty beta-adjusted delta-neutral portfolio so I'm forced to look for good bearish opportunities to an equal degree as good bullish ones. I also compute my theta for the portfolio to avoid getting super theta-negative. Finally, I compute the probability of a win or a break-even in realtime for each combo position. 2) "Odd Finder" which searches for unusual options activity. For example, today there was nearly $2M of AAPL Nov 75 puts sold. (11% were bought on the ask, 88% were sold on the bid). It's pretty unusual to see so many puts sold on a 1% down day. 3) "Target Finder" which takes a price, IV change estimate, and timeframe and will tell me which is the best strategy to use. (e.g. sometimes it's just calls, sometimes verticals, sometimes calendars) 4) "Box Finder" which computes yields in realtime on long or short boxes. 5) Planner which allows me to put in arbitrary combinations of options and stock and see the payoff curves. There's a bunch of stuff specifically for trading futures spreads and eurodollars, but that's another story. Programming this stuff myself allows me to build a tool that I need, rather than relying on others. I essentially started with Tradestation and got annoyed at its limitations (in particular, portfolio management is practically nonexistent), and built from there.
FA, Sounds like you have a pretty nice component there. I started out on the same track as you, with TS. Still use it to check sometimes. You can't beat the charting and data there. But you are right it limits what you can do as far as automation and so forth.