Construction of backtesting system for option strategies (such as vertical spread)

We hope to build an options vertical spread backtesting system that can effectively backtest indexes (such as RUT, SPX, etc.) and digital currencies (such as BTC, ETH, etc.);



Find out the optimal parameters for opening a position, taking profit, and stopping loss; the cycle plan ranges from 1 to 6 weeks; mainly being a seller.



The half-baked plans (and problems) are as follows:



1 data source?

Can be obtained from yfinance or deribit API





2. Obtaining conditions (such as IV Percentile)?

If you calculate it yourself, what is the formula?

Some websites provide it, but it is inconsistent with the IV Percentile provided by ThinkOrSwim (TOS). Maybe the algorithm of each company is not completely consistent.





3. Recommendations for choosing a backtesting framework? or which frameworks support backtesting of options?

I heard that QuantConnect and Optopsy meet the requirements. Is there anyone who has used it and can give some reviews? From a personal usability perspective





4 Are the mainstream option trading platforms consistent? For example: Are the options prices of Interactive Broker and ThinkOrswim exactly the same?



Are the results of the former backtest applicable to the latter?





Thanks for your input in advance

Hi Rong,



I´m trying the same but focusing on straddles. 

Where do you obtain historical option prices? I think that yfinance is no longer providing that kind of data. I´ve downloaded and processed a bunch of monthly options from OptionDX



Does Optopsy allows you to backtest following your triggers and customised signals? 



Have you tried using any of the codes provided by quantra? Or do you recommend QuantConnect?



Thanks

Hi Rong,

  1. You can obtain the data from data vendors or brokers of your choice that suits your goals in terms of cost, resolution, etc. However, please do your due diligence before getting the data from any broker/data vendor. 
  2. IV percentile can be calculated using the formula:  IV percentile = (Number of IV values below current IV / Total number of IV values) * 100
  3. I would suggest you create your own backtesting framework instead of relying on some third-party frameworks.
  4. The prices might differ a bit across trading platforms due to their price aggregation algorithms and might not be exactly the same. 

Hope this helps!