chain = slice.OptionChains.get(self.symbol)
这句代码应该返回一个OptionChain对象,Cloud IDE在调试过程中,VARIABLES Panel中在chain.Contracts.Values中不会看见OptionContract的任何属性。
OptionContract应该包含如下属性:
Symbol: Symbol
UnderlyingSymbol: Symbol
Strike: decimal
Expiry: DateTime
Right: OptionRight
Style: OptionStyle
TheoreticalPrice: decimal
ImpliedVolatility: decimal
Greeks: Greeks
Time: DateTime
OpenInterest: decimal
LastPrice: decimal
Volume: int
BidPrice: decimal
BidSize: int
AskPrice: decimal
AskSize: int
UnderlyingLastPrice: decimal
Mia Alissi
The
chain
object you mentioned is indeed anOptionChain
object. It contains a collection ofOptionContract
objects. EachOptionContract
object has the properties you listed.Here is an example of how you can access these properties in Python:
Please note that not all properties are always populated depending on the data source and the specific contract. For example,
TheoreticalPrice
andGreeks
are only available if you set a pricing model.For more information, you can refer to the QuantConnect documentation.
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.
HONGYUZHANG
调试截图
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.
HONGYUZHANG
Pull Organization Workspace之后提示如图
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!