def Initialize(self):
        ''' Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        # Set requested data resolution
        self.UniverseSettings.Resolution = Resolution.Minute

        self.SetStartDate(2013, 10, 7)  #Set Start Date
        self.SetEndDate(2013, 10, 11)  #Set End Date
        self.SetCash(100000)  #Set Strategy Cash

        # Find more symbols here: http://quantconnect.com/data
        # Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily.
        # Futures Resolution: Tick, Second, Minute
        # Options Resolution: Minute Only.
        symbols = [Symbol.Create("SPY", SecurityType.Equity, Market.USA)]

        # set algorithm framework models
        self.SetUniverseSelection(ManualUniverseSelectionModel(symbols))
        self.SetAlpha(
            ConstantAlphaModel(InsightType.Price, InsightDirection.Up,
                               timedelta(minutes=20), 0.025, None))
        self.SetPortfolioConstruction(
            EqualWeightingPortfolioConstructionModel())
        self.SetExecution(ImmediateExecutionModel())
        self.SetRiskManagement(MaximumDrawdownPercentPerSecurity(0.01))

        self.Debug("numpy test >>> print numpy.pi: " + str(np.pi))
Esempio n. 2
0
    def Initialize(self):

        # Set requested data resolution
        self.UniverseSettings.Resolution = Resolution.Daily

        self.SetStartDate(2014, 3, 25)
        self.SetEndDate(2014, 4, 7)
        self.SetCash(100000)

        # set algorithm framework models
        self.SetUniverseSelection(FineFundamentalUniverseSelectionModel(self.SelectCoarse, self.SelectFine))
        self.SetAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, timedelta(1)))
        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
        self.SetRiskManagement(MaximumSectorExposureRiskManagementModel())
Esempio n. 3
0
    def Initialize(self):

        self.SetStartDate(2013, 1, 1)
        self.SetEndDate(2015, 1, 1)
        self.SetCash(100000)

        fastPeriod = 100
        slowPeriod = 300
        count = 10

        self.UniverseSettings.Leverage = 2.0
        self.UniverseSettings.Resolution = Resolution.Daily

        self.SetUniverseSelection(
            EmaCrossUniverseSelectionModel(fastPeriod, slowPeriod, count))
        self.SetAlpha(
            ConstantAlphaModel(InsightType.Price, InsightDirection.Up,
                               timedelta(1), None, None))
        self.SetPortfolioConstruction(
            EqualWeightingPortfolioConstructionModel())