I've been working on something with similar issues and am a bit stuck currently as well. I think options functionality in the framework is a nice idea, but there are some issues to work through.
Per the comments above on using the OptionChainProvider, it is unfortunately not sufficient when weekly options are desired or the greeks are needed on the chain prior to selection. I've been trying to work a solution based from Alexandre's comment in the link below (which is from 2017). By controlling it in the OnSecuritiesChanged. However, a runtime error has been persistant with this method and is associated with adding the options but only well after they are added and it never gets to a point to remove them to even test that part of the code. I'm currious if there are any better ways that one might employ when weekly options are needed at a minimum within the framework? If get a chance to make a minimum reproducible example, I attach one.
Stephan,
Your warmup issue of AddOption that Alexandre referenced was that you added the option chain in the same data slice that you try to access it. Data doesn't get piped in until the next slice. So it would be better to use the event handler where it adds it when securities change. It could be done in the OnData, but would have to only use it at the next slice and so you would have to keep track of things with more complicated logic.
Alexandre,
Is the RemoveSecurity function not a recommended method to take an option contract out of the universe currently, or better will it still work (granted it is not likely recommended manually doing anything). The documentation page (below) is not working these days and I haven't been able to look it up without making assumptions from the github page.
https://www.quantconnect.com/lean/docs#topic27616.html
https://www.quantconnect.com/forum/discussion/2928/how-to-keep-an-updated-option-universe/p1