Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-2.875
Tracking Error
0.116
Treynor Ratio
0
Total Fees
$0.00
class Algorithm(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2020,1,1)  
        self.SetEndDate(2020,2,5)    
        self.SetCash(100000)          
        self.UniverseSettings.Resolution = Resolution.Daily
        self.AddUniverse(self.CoarseSelectionFunction)
        self.Schedule.On(self.DateRules.EveryDay(), 
                         self.TimeRules.At(9, 30), 
                         Action(self.Rebalance))
        self.IsFirstTime = True
                         
     

    def CoarseSelectionFunction(self, coarse):
        if self.IsFirstTime:
            applSymbol = Symbol.Create("APPL", SecurityType.Equity, Market.USA)
            self.IsFirstTime = False
            return [applSymbol]
        else:
            return []
            
        

    def OnSecuritiesChanged(self, changes):
        self.Debug("{}: changed".format(self.Time))
        for sym in changes.RemovedSecurities:
            self.Debug("{}: Removed: {}".format(self.Time, sym))
        for sym in changes.AddedSecurities:
            self.Debug("{}: Added: {}".format(self.Time, sym))
        
    def Rebalance(self):
        applSymbol = Symbol.Create("APPL", SecurityType.Equity, Market.USA)
        self.SetHoldings([PortfolioTarget(applSymbol, 0.1)])
        self.Debug("{}: Rebalance len: {}".format(self.Time, len(self.Securities)))