Overall Statistics
Total Trades
24
Average Win
0%
Average Loss
0%
Compounding Annual Return
0.020%
Drawdown
0.000%
Expectancy
0
Net Profit
0.012%
Sharpe Ratio
1.098
Probabilistic Sharpe Ratio
53.218%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0
Beta
0.001
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-2.496
Tracking Error
0.117
Treynor Ratio
0.201
Total Fees
$24.00
Estimated Strategy Capacity
$320000000000.00
Lowest Capacity Asset
GME SC72NCBXXAHX
class CasualYellowGreenAnguilline(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 12, 15)
        self.SetCash(10000000) 
        self.dataBySymbol = {}
       
        self.AddUniverse(self.MyCoarseFilterFunction)

    def MyCoarseFilterFunction(self, coarse):
         sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
         filtered = [ x.Symbol for x in sortedByDollarVolume 
                      if x.Price > 10 and x.DollarVolume > 10000000 ]
         return filtered[:5]
    def OnData(self, data):
        for symbol,Data in self.dataBySymbol.items():
            if not Data.IsReady:continue
            if not self.Portfolio[symbol].Invested and symbol in data.Bars and Data.slow.Current.Value<Data.fast.Current.Value:
                self.MarketOrder(symbol,1)
                
    def OnSecuritiesChanged(self,changes):
        for x in changes.AddedSecurities:
            if x.Symbol not in self.dataBySymbol:
               self.dataBySymbol[x.Symbol] = SymbolData(self,x.Symbol)
        for x in changes.RemovedSecurities:
            symbol_data = self.dataBySymbol.pop(x.Symbol, None)
            if symbol_data:
                  symbol_data.dispose()
class SymbolData:
    def __init__(self,algo,symbol):
        self.algo = algo
        self.symbol = symbol
        self.slow = SimpleMovingAverage(100)
        self.fast = SimpleMovingAverage(20)
        history = self.algo.History(self.symbol, 200, Resolution.Daily)
        
        for bar in history.loc[self.symbol, :].itertuples():
            self.slow.Update(bar.Index,bar.close)
            self.fast.Update(bar.Index,bar.close)
            
        self.consolidator = TradeBarConsolidator(1)
        self.consolidator.DataConsolidated += self.consolidation_handler
        self.algo.SubscriptionManager.AddConsolidator(symbol, self.consolidator)
        
        
        
    def consolidation_handler(self, sender, consolidated):
        self.slow.Update(consolidated.EndTime, consolidated.Close)
        self.fast.Update(consolidated.EndTime, consolidated.Close)
    @property        
    def IsReady(self):
        return self.slow.IsReady
        
    def dispose(self):
        self.algo.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)