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
-6.962
Tracking Error
0.042
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
class SquareBrownJellyfish(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 2, 11)
        self.SetEndDate(2021, 2, 16)
        self.SetCash(100000) 
        self.AddUniverse(self.MyCoarseFilterFunction)
        self.volumeBySymbol = {}

    def MyCoarseFilterFunction(self, coarse):
        # some initial screening filter
        filtered = [ x for x in coarse if x.Price > 10 and x.DollarVolume > 10000000 ]
        
        for x in filtered:
            if x.Symbol not in self.volumeBySymbol:
                self.volumeBySymbol[x.Symbol] = SymbolData(x.Symbol, self)
            self.volumeBySymbol[x.Symbol].Update(x.EndTime, x.Volume)
        
        sortBySMAVolume = sorted(self.volumeBySymbol.items(), key=lambda x: x[1].sma.Current.Value, reverse=True)[:10]
        symbols = [x[0] for x in sortBySMAVolume]
        return symbols
    
class SymbolData:
    def __init__(self,symbol,algo):
        self.algo = algo
        self.symbol = symbol
        self.sma = SimpleMovingAverage(30)
        history = algo.History(symbol,30,Resolution.Daily)
        if not history.empty:
            for time,row in history.loc[symbol].iterrows():
                self.sma.Update(time,row['volume'])
    def Update(self,time,vol):
        self.sma.Update(time,vol)