Alright, I've tried to fix some further bugs:

  • In-the-money and out-the-money is now relative to option type
  • Fixed some logic in the maturity declarations
  • Fixed the way options are referred to

The way we can refer to options is now (when using "MONTHLY" options):

Order("SPY.CALL.1.0", 80*100);

which means: Buy 80 CALL contracts with the first in-the-money strike price with the maturity in this month.

Or, an example for "WEEKLY" options:

Order("SPY.PUT.-2.2", 80*100);

which means: Buy 80 PUT contracts with the second out-the-money strike price with the maturity in two weeks.

Another example:

Order("SPY.CALL.-2.0", 80*100);

which means: Buy 80 CALL contracts with the second out-the-money strike price with the maturity in this week.

As I'm currently doing my master's (Quant Finance of course), I won't be able to spend any more time on this framework. I hope it can suffice as a help (or inspiration) to the formal framework that Jared&Team are developing.

Mind you, however, that I'm calculating the theoretical price of European options. Calculating the price of American options is a bit more difficult. Maybe QuantConnect can reach out to iVolatility, which have a very good calculator for both option types. Maybe they are willing to share their code? (Even CBOE uses their calculator)

Anyway, I wish you guys good luck with the formal framework!

Author