Overall Statistics
import numpy as np
import pandas as pd


class BootCampTask(QCAlgorithm):
    
        
    def Initialize(self):

        self.SetCash(1000000)
        # Start and end dates for the backtest.
        self.SetStartDate(2017,6,1)
        self.SetEndDate(2017,6,15)
        
        
        # Manually Select Data     
        self.spy = self.AddEquity("SPY", Resolution.Minute)
        self.iwm = self.AddEquity("IWM", Resolution.Minute)
        
        # Schedule the rebalance function
        self.Schedule.On(self.DateRules.EveryDay("SPY"), 
        self.TimeRules.AfterMarketOpen("SPY", 30), 
        Action(self.rebalance))
        
        
    
    def OnData(self, data):
        pass


    def rebalance(self):

        # Do something here
        
        if not self.Securities["SPY"].Invested:
            self.SetHoldings("SPY", 0.5)
        
        if not self.Securities["IWM"].Invested:
            self.SetHoldings("IWM", 0.5)
            
        
        invested = [ x.Symbol.Value for x in self.Portfolio.Values if x.Invested ]
        self.Log("Invested:  " + str(len(invested)) + ':  '+ str(invested))