During the algorithm initialization, the following exception has occurred: ArgumentException : Unable to locate exchange hours for Base-empty-[*]
at QuantConnect.Securities.MarketHoursDatabase.GetEntry (System.String market, System.String symbol, QuantConnect.SecurityType securityType) [0x00073] in <81ef2e23b9484204a306f48b708f2b82>:0
at QuantConnect.Securities.MarketHoursDatabase.GetEntry (System.String market, QuantConnect.Symbol symbol, QuantConnect.SecurityType securityType) [0x00009] in <81ef2e23b9484204a306f48b708f2b82>:0
at QuantConnect.Securities.SecurityManager.CreateSecurity (QuantConnect.Securities.SecurityPortfolioManager securityPortfolioManager, QuantConnect.Data.SubscriptionManager subscriptionManager, QuantConnect.Securities.MarketHoursDatabase marketHoursDatabase, QuantConnect.Securities.SymbolPropertiesDatabase symbolPropertiesDatabase, QuantConnect.Securities.ISecurityInitializer securityInitializer, QuantConnect.Symbol symbol, QuantConnect.Resolution resolution, System.Boolean fillDataForward, System.Decimal leverage, System.Boolean extendedMarketHours, System.Boolean isInternalFeed, System.Boolean isCustomData, System.Boolean isLiveMode, System.Boolean addToSymbolCache) [0x00024] in <81ef2e23b9484204a306f48b708f2b82>:0
at QuantConnect.Algorithm.QCAlgorithm.AddFutureContract (QuantConnect.Symbol symbol, QuantConnect.Resolution resolution, System.Boolean fillDataForward, System.Decimal leverage) [0x0002d] in <e2b4844fe7074f15aa37f72bb91759f0>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <2e7c1c96edae44d496118948ca617c11>:0
at Initialize in main.py:line 18
ArgumentException : Unable to locate exchange hours for Base-empty-[*]
at QuantConnect.Securities.MarketHoursDatabase.GetEntry (System.String market, System.String symbol, QuantConnect.SecurityType securityType) [0x00073] in <81ef2e23b9484204a306f48b708f2b82>:0
at QuantConnect.Securities.MarketHoursDatabase.GetEntry (System.String market, QuantConnect.Symbol symbol, QuantConnect.SecurityType securityType) [0x00009] in <81ef2e23b9484204a306f48b708f2b82>:0
at QuantConnect.Securities.SecurityManager.CreateSecurity (QuantConnect.Securities.SecurityPortfolioManager securityPortfolioManager, QuantConnect.Data.SubscriptionManager subscriptionManager, QuantConnect.Securities.MarketHoursDatabase marketHoursDatabase, QuantConnect.Securities.SymbolPropertiesDatabase symbolPropertiesDatabase, QuantConnect.Securities.ISecurityInitializer securityInitializer, QuantConnect.Symbol symbol, QuantConnect.Resolution resolution, System.Boolean fillDataForward, System.Decimal leverage, System.Boolean extendedMarketHours, System.Boolean isInternalFeed, System.Boolean isCustomData, System.Boolean isLiveMode, System.Boolean addToSymbolCache) [0x00024] in <81ef2e23b9484204a306f48b708f2b82>:0
at QuantConnect.Algorithm.QCAlgorithm.AddFutureContract (QuantConnect.Symbol symbol, QuantConnect.Resolution resolution, System.Boolean fillDataForward, System.Decimal leverage) [0x0002d] in <e2b4844fe7074f15aa37f72bb91759f0>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <2e7c1c96edae44d496118948ca617c11>:0
It says something about not finding something in initialize. Here's my Initialize function:
def Initialize(self):
self.SetStartDate(2009,1,2) #Set Start Date
self.SetEndDate(2018,7,26) #Set End Date
self.SetCash(100000) #Set Strategy Cash
# Find more symbols here: http://quantconnect.com/data
Tbond = self.AddFutureContract("ZB", Resolution.Second, True, 9)
Tbond = self.AddSecurity(SecurityType.Future, "ZB", Resolution.Second, True, 9)
self.Debug("numpy test >>> print numpy.pi: " + str(np.pi))
Gurumeher Sawhney
The reason why this error occurred was because of the following line. This method call required a Symbol object and was passed a string.
Tbond = self.AddFutureContract("ZB", Resolution.Second, True, 9)
This documentation is a good guide for adding and using future data. Adding "ZB" is as easy as this:
Tbond = self.AddFuture("ZB")
Kj5159
Thank you. I read this part in the documentation:
Kj5159
In the format: self.AddFuture(Futures.Indices.SP500EMini, Resolution.Minute), what is the "category", where "Indices" is for ES, but for ZB? I've tried "Rates", "Financials", and "InterestRates"...Not sure what else to try and plug in. Any help would be appreciated.
Alex Muci
@Kj5159 it should be self.AddFuture(Futures.Financials.Y30TreasuryBond, Resolution.Minute)
see
Kj5159
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!