Not sure if I am misunderstanding the framework algorithm wizard. The one where we can select what looks like some pre-built modules:
I created a simple framework and then ran it immediately for testing and it returned this error.
Runtime Error: Trying to retrieve an element from a collection using a key that does not exist in that collection throws a KeyError exception. To prevent the exception, ensure that the GGP R735QTJ8XC9X key exist in the collection and/or that collection is not empty. KeyError : 'the label [GGP R735QTJ8XC9X] is not in the [index]' (Open Stacktrace)
Here is the code it generated:
from Selection.QC500UniverseSelectionModel import QC500UniverseSelectionModel
from Alphas.RsiAlphaModel import RsiAlphaModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
from Execution.VolumeWeightedAveragePriceExecutionModel import VolumeWeightedAveragePriceExecutionModel
from Risk.MaximumSectorExposureRiskManagementModel import MaximumSectorExposureRiskManagementModel
class BasicTemplateFrameworkAlgorithm(QCAlgorithmFramework):
def Initialize(self):
# Set requested data resolution
self.UniverseSettings.Resolution = Resolution.Minute
self.SetStartDate(2018, 3, 16) #Set Start Date
self.SetEndDate(2018, 9, 16) #Set End Date
self.SetCash(100000) #Set Strategy Cash
self.SetUniverseSelection(QC500UniverseSelectionModel())
self.SetAlpha(RsiAlphaModel(60, Resolution.Minute))
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
self.SetExecution(VolumeWeightedAveragePriceExecutionModel())
self.SetRiskManagement(MaximumSectorExposureRiskManagementModel())
def OnOrderEvent(self, orderEvent):
if orderEvent.Status == OrderStatus.Filled:
# self.Debug("Purchased Stock: {0}".format(orderEvent.Symbol))
pass
I assume it should run correct? Or am I missing something?
As always, thanks!