Hi There,
I have spent the last couple of months building up my algo to get it ready for deployment and bought a live node last week in order to get it running with paper trading. However I have been running it for the last week live and it has not made any moves at all, I have backtested this algo hundreds of times and it works fine so I was initially a little perplexed.
anyway long story short I have run Logs all the way through it when it's running live and found that when the system runs through slice.OptionChains using the code below (works in backtest fine), the length of slice.OptionChains is 0 (no option chains are loaded into this???)
def sell_put(self,slice,underlying):
self.Log("attempting to Sell Put")
self.Graph()
putchain = None
self.Log(str(len(slice.OptionChains)))
for i in slice.OptionChains:
if str(i.Value.Symbol.Underlying) == str(underlying):
putchain = i.Value
self.Log("found put chain")
break
if putchain is None: return
So I'm left thinking that when its running live, for some reason slice.OptionChains is not being populated with data.
I don't want to share too much of the code, but here is what im running as my initialize to load the options as well as the universe function:
def Initialize(self):
self.SetStartDate(2016, 1, 15)
self.SetEndDate(2021, 3,21)
self.SetCash(10000)
self.resolution = Resolution.Minute
self.stocks = ["AMD"]
self.symbols = []
self.sell_options = True
self.Leverage = 1.0
self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage,AccountType.Margin)
for ticker in self.stocks:
equity = self.AddEquity(ticker, self.resolution) #Adding
self.Securities[ticker].SetDataNormalizationMode(DataNormalizationMode.Raw)
option = self.AddOption(ticker, self.resolution) #Adding Options Chain
#option.SetFilter(self.UniverseFunc)
option.SetFilter(timedelta(0), timedelta(180))
option.PriceModel = OptionPriceModels.CrankNicolsonFD()
self.symbols.append(option)
#assigns the first stock to a variable so it can be used in the date time scheduler to turn on the system at times of the day
self.symbol = self.stocks[0]
self.SetWarmUp(timedelta(2))
self.Schedule.On(self.DateRules.EveryDay(),self.TimeRules.At(9, 40),self.Graph)
#self.Schedule.On(self.DateRules.EveryDay(self.symbol),self.TimeRules.AfterMarketOpen(self.symbol, 10),self.trade)
#self.Schedule.On(self.DateRules.EveryDay(self.symbol),self.TimeRules.AfterMarketOpen(self.symbol, 240),self.trade)
#self.Schedule.On(self.DateRules.EveryDay(self.symbol),self.TimeRules.BeforeMarketClose(self.symbol, 10),self.trade)
self.Schedule.On(self.DateRules.EveryDay(self.symbol),self.TimeRules.Every(TimeSpan.FromMinutes(2)),self.trade)
def UniverseFunc(self, universe):
# include weekly contracts
return universe.Expiration(TimeSpan.FromDays(5),TimeSpan.FromDays(15))
Any help would be wonderful
Cheers
Jared Broad
Hey @MatteMatto; please send in a support ticket with the live algorithm attached so we can pull down its logs. We fixed an issue yesterday where the option chain data format changed without notice. Your live strategy might have been affected by this.
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.
MatteMatto
Solved:
Quantconnect Does not provide option chain data in its Live Paper Trader, it must be extrracted from a brokerage.
MatteMatto
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!