The SetFilter funciton does not correctly choose the ATM strike price, making it difficult to backtest. I have not been able to figure out exactly how it chooses its median value for the ATM strike price, but it seems pretty random. It can sometimes be off by 15 dollars or more. I have created a backtest that shows this issue. I have logged the underlying price and the chosen strike price when options are traded.

From the docs:

By default, the option universe is filtered down to contracts that expire within 35 days, one contract below and another above ATM, and exclude weeklys.

Also, how do you set the SetFilter function to include weeklys?

Author