Hello,

I am kicking the tires as it were with QC Lean. I have installed and executed the 'BasicTemplateForexAlgorithm', which worked a treat. I have made some very minor changes and I am having issues with using Oanda market.

class BasicTemplateForexAlgorithm(QCAlgorithm): def Initialize(self): # Set the Broker and Time Zone self.SetBrokerageModel(BrokerageName.OandaBrokerage, AccountType.Margin) self.SetTimeZone(TimeZones.Utc) # Set the cash we'd like to use for our backtest self.SetCash(10000) # No trades until 7 days of data is backfilled self.SetWarmUp(timedelta(7)) # self.BrokerageModel(BrokerageName.OandaBrokerage, AccountType.Cash) # Start and end dates for the backtest. self.SetStartDate(2013, 10, 7) self.SetEndDate(2014, 10, 11) # Add FOREX contract you want to trade # find available contracts here https://www.quantconnect.com/data#forex/oanda/cfd self.AddForex("EURUSD", Resolution.Minute, Market.Oanda) self.History(5, Resolution.Daily) self.History(5, Resolution.Hour) self.History(5, Resolution.Minute) history = self.History(TimeSpan.FromSeconds(5), Resolution.Second) for data in sorted(history, key=lambda x: x.Time): for key in data.Keys: self.Log(str(key.Value) + ": " + str(data.Time) + " > " + str(data[key].Value)) def OnData(self, data): # Print to console to verify that data is coming in for key in data.Keys: self.Log(str(key.Value) + ": " + str(data.Time) + " > " + str(data[key].Value)) if not self.Portfolio.Invested: self.MarketOrder("EURUSD", 1000)

The above generates:

20201222 10:51:01.288 ERROR:: WorkerThread.<.ctor>b__7_0(): WorkerThread(): exception thrown when running task Python.Runtime.PythonException: AttributeError : Oanda at Python.Runtime.PyObject.Invoke (Python.Runtime.PyTuple args, Python.Runtime.PyDict kw) [0x00033] in <c56ab175820d412caf052e079c2ab9ef>:0 at Python.Runtime.PyObject.InvokeMethod (System.String name, Python.Runtime.PyTuple args, Python.Runtime.PyDict kw) [0x00007] in <c56ab175820d412caf052e079c2ab9ef>:0 at Python.Runtime.PyObject.TryInvokeMember (System.Dynamic.InvokeMemberBinder binder, System.Object[] args, System.Object& result) [0x0003e] in <c56ab175820d412caf052e079c2ab9ef>:0 at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object) at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0] (System.Runtime.CompilerServices.CallSite site, T0 arg0) [0x00108] in <c5bd4c865d5d48d3b3ebe4d522fd6bd7>:0 at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Initialize () [0x00045] in <85af64086f2a462698351dd6ddf624f9>:0 at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler+<>c__DisplayClass25_0.<Setup>b__0 () [0x00001] in <4a2f8a2099ea4690a33d7568fdba771c>:0 at QuantConnect.Util.WorkerThread.<.ctor>b__7_0 () [0x00036] in <38bf31a5ef9c46f496bcfa88c8e08a07>:0

I am not sure why it is throwing an AttributeError. Any and all help would be much appreciated. I would also like to enquire if Oanda integration has a facility for stop loss, trailing stop, and TP.

Thank you for your time,

-Jace