Overall Statistics
Total Trades
96
Average Win
0.05%
Average Loss
-0.30%
Compounding Annual Return
-26.058%
Drawdown
24.100%
Expectancy
-0.706
Net Profit
-13.978%
Sharpe Ratio
-1.087
Probabilistic Sharpe Ratio
2.959%
Loss Rate
75%
Win Rate
25%
Profit-Loss Ratio
0.16
Alpha
-0.195
Beta
0.64
Annual Standard Deviation
0.164
Annual Variance
0.027
Information Ratio
-1.595
Tracking Error
0.129
Treynor Ratio
-0.278
Total Fees
$96.06
Estimated Strategy Capacity
$550000000.00
Lowest Capacity Asset
MMM R735QTJ8XC9X
# region imports
from AlgorithmImports import *
# endregion

class SmoothYellowGreenKitten(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2022, 8, 6)  # Set Start Date
        self.SetEndDate(2023, 2, 5)
        self.SetCash(100000)  # Set Strategy Cash
        
        self.AddUniverse(self.coarse_filter, self.fine_filter)
        self.UniverseSettings.Resolution = Resolution.Daily
        self.curr_month = -1

    def OnData(self, data: Slice):
        if self.Time.month == self.curr_month:
            return
        self.curr_month = self.Time.month
        stocks = [s for s in self.Securities.Keys]
        to_liquidate = [s for s in self.Portfolio.Keys if s not in stocks]
        for stock in stocks:
            self.SetHoldings(stock, 1/len(stocks))
        for stock in to_liquidate:
            self.Liquidate(stock)

    def coarse_filter(self, coarse: Collection[CoarseFundamental]):
        # volume, price of a share
        filtered = [c for c in coarse if c.Price > 10 and c.HasFundamentalData]
        sortedByDVol = sorted(filtered, key=lambda c:c.DollarVolume, reverse=True)
        top10 = sortedByDVol[:50]
        return [c.Symbol for c in top10]

    def fine_filter(self, fine):
        # revenue, profits, assets, debts
        filtered = [f for f in fine if f.ValuationRatios.PERatio < 20]
        sortedByPE = sorted(filtered, key=lambda f:f.ValuationRatios.PERatio)
        return [f.Symbol for f in fine][:10]