I want to see if my portfolio has an open call/put position in an underlying. I know there is a .IsLong and .IsShort for stocks but I can't find the same thing for options. The only other option is .Invested which will not state if it is a call or put.
Jing Wu
You could get a list of symbol objects in
option_invested = [x.Key for x in self.Portfolio if x.Value.Invested and x.Value.Type==SecurityType.Option]
By looping this list, you will find if those options are in long or short position. For example
for option in option_invested:    if option.IsLong    if option.IsShort    if option.ID.OptionRight == OptionRight.Call (get the option right)    if option.ID.StrikePrice (get the strike price)    if option.ID.Date (get the expiration date)
Paul Park
Is there a way to get the bid price? The secuirty identifier class does not have a feature to get an option's bid price
Nicolas Ferrari
Thanks Jing Wu, that info is very useful.
Paul Park
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!