Hello, I am working on the options strategy, in my backtesting I see several errors like this:
2019-04-22 09:31:00 : The security with symbol 'WDFC 190517C00180000' is marked as non-tradable.
I don't understand why this contract is non-tradeable, its expiration date looks correct, is there other reasons for that?
Also, how can I detect this in my code? I cannot see any field that would mark the contract as tradeable or not. It seems the only way is to place an order and handle fill error, but this is far from ideal.
Even more weirdly, when I tried to isolate this in separate project (I cannot share the original code), it does sell the contract, although with a warning about stale price. So I'm really not sure about the nature of this problem.
Yuri Lopukhov
Ok, so far I have figured out a few things:
IsTradeable is a field on the Security class, not Symbol, so I can check that.
Option contract is marked as non-tradeable in this piece of LEAN code:
in https://github.com/QuantConnect/Lean/blob/e7e9153fbf42a5b5d1caace8e4da7c356efff272/Engine/AlgorithmManager.cs
So I am guessing that after the split all related option contracts where there was a position are marked as non-tradeable, because option splits are not supported? Not sure the reason, but I will have to figure out some kind of work-around, perhaps liquidate options position manually before this happens.
Yuri Lopukhov
Hmm, but there are not splits for WDFC around that date. So there should be another reason for this.
Yuri Lopukhov
Ok, I figured that the problem was because contract was removed from the universe by expiration data and this marked it as non-tradeable. I wish I could accept my own answer :)
Yuri Lopukhov
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!