Overall Statistics
Total Trades
2540
Average Win
0.10%
Average Loss
-0.17%
Compounding Annual Return
24.530%
Drawdown
46.600%
Expectancy
0.134
Net Profit
311.341%
Sharpe Ratio
0.836
Probabilistic Sharpe Ratio
24.017%
Loss Rate
29%
Win Rate
71%
Profit-Loss Ratio
0.60
Alpha
0.077
Beta
1.449
Annual Standard Deviation
0.304
Annual Variance
0.093
Information Ratio
0.646
Tracking Error
0.204
Treynor Ratio
0.176
Total Fees
$2953.41
class HipsterVioletRabbit(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2014, 9, 10)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddUniverse(self.MyCoarseFilterFunction, self.MyFineFundamentalFunction)
        
        self.month = None

    def MyCoarseFilterFunction(self, coarse):
        return [c.Symbol for c in coarse if c.DollarVolume > 1e7]

    def MyFineFundamentalFunction(self, fine):
        tech = [x for x in fine if x.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.Technology]
        
        unprofitable = [x for x in tech if x.FinancialStatements.IncomeStatement.NormalizedIncomeAsReported.ThreeMonths <= 0]
        
        sorted_revenue = sorted(unprofitable, key=lambda f: f.FinancialStatements.IncomeStatement.TotalRevenue.OneMonth, reverse=True)
        
        return [f.Symbol for f in sorted_revenue[:50]]


    def OnData(self, data):
        if self.month == self.Time.month:
            return
        
        self.month = self.Time.month
        
        securities = data.Keys
        n_securities = len(securities)
        
        for s in securities:
            self.SetHoldings(s, 1 / n_securities)