Backtesting a trading strategy is critical in trading. Countless blogs, books, and papers discuss the art of backtesting. Most of these focus on equity and futures markets using off-the-shelf software like Trade Station. There are an equal number of discussions on the trade-off between buying off-the-shelf software and writing your own. What seems to be less discussed is backtesting options trading strategies. There are of course notable exceptions but in large, there's not much.
I've been trading listed equity options for almost a decade. Usually, I'm looking at the underlying to determine the "optimal" options strategy. I've been slowly picking my way though options backtesting code since 2013. But like the best of us, I get sidetracked with other projects often. I thought if I blogged my progress in building code for backtesting options trading strategies, I'd actually make some.
Backtesting options trading strategies
Options have several dimensions not present in equities and even futures. With equities, you look at time, price and maybe volume. With options, you have time, price, volume, open interest, expiration, strike, and volatility. Plus the sheer amount of data makes storage and parsing it all quite a challenge. I by no means plan on reinventing the wheel with this project. As one developer friend of mine once said, "programmers are only as good as their google searches". There's plenty of high quality code I plan on leveraging.
Why am I building code for backtesting options trading strategies?
I want to systematically select strategies that have a statistical edge. You're not going to win making "informed" decisions on either direction or volatility on the underlying. I'm a retail trader and it's well-known (here and here) how bad we get f***ed by the high frequency guys. Even our own brokers are against us. I hope to draw on the collective community on this project as well. I want to post code so I can get pointers and feedback along the way.
What to expect from this blog?
This blog will largely be a combination of the following topics, subject to change through time:
- Backtesting Research and resources in backtesting and backtesting software, discussion on the finer points around backtesting (e.g. biases, curve fitting, etc.) and how the fundamentals of backtesting will be used in the options backtesting system
- Requirements Functional and technical requirements for the system and an in-depth review of the potential technical options for the system.
- Options Theoretical derivation and discussion of options pricing models and sensitivities, code for the pricing and trading strategies.
- Code The entire point of this blog is to build the software for the system so all code involved - from pricing models to data acquisition - will be included
- A robust and working stack for backtesting options trading strategies
I'll look to post a few times per month or more but will focus on quality over quantity. I'll also make my best attempt to inject humor and sarcasm as we go. What's a good trading blog without some quick wit