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
0.074
Tracking Error
0.039
Treynor Ratio
0
Total Fees
$0.00
class PensiveYellowGreenAnguilline(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 2, 10)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.yesterdays_close_by_symbol = {}
        self.AddUniverseSelection(
               FineFundamentalUniverseSelectionModel(self.SelectCoarse, self.SelectFine)
        )
    
    def SelectCoarse(self, coarse):
        sorted_by_dollar_volume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
        
        symbols = []
        for c in sorted_by_dollar_volume[:10]:
            self.yesterdays_close_by_symbol[c.Symbol] = c.AdjustedPrice
            symbols.append(c.Symbol)
        return symbols
    
    def SelectFine(self, fine):
        return [f.Symbol for f in fine] 


    def OnSecuritiesChanged(self, changes):
        for security in changes.RemovedSecurities:
            self.yesterdays_close_by_symbol.pop(security.Symbol, None)


    def OnData(self, data):
        
        for symbol, yesterdays_close in self.yesterdays_close_by_symbol.items():
            if not (data.ContainsKey(symbol) and data[symbol] is not None):
                continue
            close = data[symbol].Close
            intraday_return = (close - yesterdays_close) / yesterdays_close
            if intraday_return < -0.05:
                self.Log(f"{symbol} down more than 5%")