Overall Statistics
from datetime import timedelta

class TickAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2018, 1, 1) 
        self.SetEndDate(2018, 1, 3) 
        self.SetCash(50000) 
        self.AddEquity("SPY", Resolution.Hour)
        self.flag = True 

    def OnData(self, data):
        if data.ContainsKey("SPY") and self.flag:
            hist = self.History(["SPY"], timedelta(seconds=1), Resolution.Tick)
            if not hist.empty:
                self.flag = False