Overall Statistics
import numpy as np

class MyAlgorithm(QCAlgorithm):

    def Initialize(self):

        self.SetStartDate(2018,6,15)    #Set Start Date
        self.SetEndDate(2018,6,18)      #Set End Date
        self.SetCash(100000)            # Account value

        self.AddEquity("SPY", Resolution.Second)


        self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.BeforeMarketClose("SPY", 10), self.TradeBeforeMarketClose)

    def CoarseSelectionFunction(self, coarse):

        # price > 5 and volume > 500k and sector data available
        selected = [x for x in coarse if (float(x.Price) >= 5 and x.Volume > 5000000) ]

        # this is our universe
        self.Debug("selected:" + str(len(selected)))

        # subscribe to these stocks, add list of symbols to self
        self.MySymbols = []
        for x in selected:
            self.MySymbols.append(self.AddEquity(x.Symbol.Value, Resolution.Minute).Symbol)

        # return the list of symbols for consistency with "fine", but they are already saved in self.MySymbols[]
        return [ x.Symbol for x in selected ]

    # trade routine
    def TradeBeforeMarketClose(self):

            self.Debug("Selected symbols in universe: " + str(len(self.MySymbols)))

        self.MarketOrder("SPY", 100)


    # order notifications
    def OnOrderEvent(self, fill):
        order = self.Transactions.GetOrderById(fill.OrderId)
        self.Debug("{0} - {1}:TEST: {2}".format(self.Time, order.Type, fill))