self.Schedule.On(self.DateRules.Every(DayOfWeek.Tuesday, DayOfWeek.Tuesday),\ self.TimeRules.At(5,0),Action(self.Assesment)) def Assesment(self): self.Tuedata = self.History(["USDCAD","BCOUSD"],25) self.CAD = self.Tuedata.loc["USDCAD"] self.Crude= self.Tuedata.loc["BCOUSD"]

Runtime Error: QuantConnect.Scheduling.ScheduledEventException: Python.Runtime.PythonException: KeyError : 'the label [BCOUSD] is not in the [index]'
at Python.Runtime.Dispatcher.Dispatch (System.Collections.ArrayList args) [0x00018] in <69d4fd635645431aa1e955e701040fd1>:0
at __System_ActionDispatcher.Invoke () [0x00006] in <2aa87619d95d4cf1814f88102356ece6>:0
at QuantConnect.Scheduling.ScheduleManager+<>c__DisplayClass16_0.<On>b__0 (System.String name, System.DateTime time) [0x00000] in <214ef3f28e094729a007a583e21ff557>:0
at QuantConnect.Scheduling.ScheduledEvent.OnEventFired (System.DateTime triggerTime) [0x00036] in <214ef3f28e094729a007a583e21ff557>:0
at QuantConnect.Scheduling.ScheduledEvent.OnEventFired (System.DateTime triggerTime) [0x00086] in <214ef3f28e094729a007a583e21ff557>:0
at QuantConnect.Scheduling.ScheduledEvent.Scan (System.DateTime utcTime) [0x0010f] in <214ef3f28e094729a007a583e21ff557>:0
at QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.SetTime (System.DateTime time) [0x0001f] in <a510f70a13de4ccba1d2d2354c76e59f>:0
at QuantConnect.Lean.Engine.AlgorithmManager.Run (QuantConnect.Packets.AlgorithmNodePacket job, QuantConnect.Interfaces.IAlgorithm algorithm, QuantConnect.Lean.Engine.DataFeeds.IDataFeed feed, QuantConnect.Lean.Engine.TransactionHandlers.ITransactionHandler transactions, QuantConnect.Lean.Engine.Results.IResultHandler results, QuantConnect.Lean.Engine.RealTime.IRealTimeHandler realtime, QuantConnect.Lean.Engine.Server.ILeanManager leanManager, System.Threading.CancellationToken token) [0x007cd] in <a510f70a13de4ccba1d2d2354c76e59f>:0
at QuantConnect.Lean.Engine.Engine+<>c__DisplayClass8_1.<Run>b__2 () [0x00097] in <a510f70a13de4ccba1d2d2354c76e59f>:0 (Open Stacktrace)

 

 

I've been having a problem accessing historical data from pandas dataframes. I keep getting a Key error for the Brent Crude CFD. I've adjusted the dates already such that it's not a problem with looking for data that's too far back (My test starts in 2016). I used  AddCfd and specified Oanda as the data source and I'm looking to get a day's worth of hourly data. I had a similar problem with forex data from FXCM that was resolved when I set the brokerage to Oanda but no such solution is possible for the CFD data. If anyone has had a similar issue I hope you can help me / have it solved for yourself as well.

Author