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
3.789
Tracking Error
0.121
Treynor Ratio
0
Total Fees
$0.00
class TransdimensionalTachyonCompensator(QCAlgorithm):
    month = 0
    def Initialize(self):
        self.SetStartDate(2020, 10, 15)  # Set Start Date
        self.SetEndDate(2020, 10, 27)
        self.SetCash(100000)  # Set Strategy Cash
        self.trading_symbols = []
        self.UniverseSettings.Resolution = Resolution.Minute
        self.AddUniverse(self.CoarseSelectionFunction) 
        self.lookback_period = 60 
        self.spy = self.AddEquity("SPY").Symbol
        self.Train(self.DateRules.MonthStart(), self.TimeRules.AfterMarketOpen(self.spy, 0), self.train)
        
    def CoarseSelectionFunction(self, coarse):
        if self.Time.month == self.month:
            return Universe.Unchanged
        self.month = self.Time.month
        sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
        self.trading_symbols = [ x.Symbol for x in sortedByDollarVolume if x.HasFundamentalData ][:20]
        return self.trading_symbols
        
    def train(self):
        if not self.trading_symbols: return
        self.Debug(len(self.trading_symbols)) # gives a length of 20
        history = self.History(self.trading_symbols , self.lookback_period , Resolution.Daily)
        self.Debug(history.shape) # shows (1140, 5) or (1080, 5)