Overall Statistics
from datetime import timedelta, datetime

class hourlyRebalanceExample(QCAlgorithmFramework):

    def Initialize(self):

        self.SetStartDate(2017,1,1)   # Set Start Date
        self.SetEndDate(2018,11,1)    # Set End Date
        self.SetCash(1000000)          # Set Strategy Cash

        # Define tickers
        tickers = ["IBM","AAPL","MSFT"]

        # Add securities to the universe                   
        symbols = [Symbol.Create(ticker, SecurityType.Equity, Market.USA) for ticker in tickers]
        
        # Set universe data resolution
        self.UniverseSettings.Resolution = Resolution.Hour
        
        # Use Manual Universe Selection Model
        self.SetUniverseSelection(ManualUniverseSelectionModel(symbols))
        
        # Use Constant Alpha Model for insights
        self.SetAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, timedelta(hours = 1), 0.001, None))
        
        # Use EqualWeightingPortfolioConstructionModel to rebalance the portfolio
        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())