Hi there, I am pretty new to the API, jstu finished all the bootcamps, and am now trying to familiarise myself with the API by writing a simple backtest using futures, I got a runtime error though and have been scratching my head for a while as I am not sure how to debug this, googling does not find anything and the message seems a bit too generic, I think I have all the components for a backtest but somehow the code fails. this is my code (mostly drag and drop from the menu really, which is why it kinda surprise me that it fails):
from Alphas.EmaCrossAlphaModel import EmaCrossAlphaModel
from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from FuturesUniverseSelectionModel import FuturesUniverseSelectionModel
class MultidimensionalTachyonCircuit(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2018, 12, 20) # Set Start Date
self.SetEndDate(2019, 3, 31)
self.SetCash(100000) # Set Strategy Cash
self.SetUniverseSelection(FuturesUniverseSelectionModel(self.SelectFuturesSymbols))
self.AddAlpha(EmaCrossAlphaModel(50, 200, Resolution.Daily))
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
self.SetExecution(ImmediateExecutionModel())
self.SetRiskManagement(TrailingStopRiskManagementModel(0.05))
# def OnData(self, data):
# '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
# Arguments:
# data: Slice object keyed by symbol containing the stock data
# '''
# # if not self.Portfolio.Invested:
# # self.SetHoldings("SPY", 1)
def SelectFuturesSymbols(self, utcTime):
ticker = Futures.Indices.SP500EMini
return [ Symbol.Create(ticker, SecurityType.Future, Market.USA) ]
Could anyone help point my mistake please ? thank you