Overall Statistics
Total Orders
1873
Average Win
0.28%
Average Loss
-0.17%
Compounding Annual Return
11.291%
Drawdown
61.700%
Expectancy
0.769
Start Equity
100000
End Equity
288426.59
Net Profit
188.427%
Sharpe Ratio
0.356
Sortino Ratio
0.411
Probabilistic Sharpe Ratio
1.246%
Loss Rate
32%
Win Rate
68%
Profit-Loss Ratio
1.62
Alpha
-0.006
Beta
1.332
Annual Standard Deviation
0.272
Annual Variance
0.074
Information Ratio
0.1
Tracking Error
0.195
Treynor Ratio
0.073
Total Fees
$2491.81
Estimated Strategy Capacity
$3000.00
Lowest Capacity Asset
UTSI RSQ0CRVRG485
Portfolio Turnover
0.44%
# region imports
from AlgorithmImports import *
# endregion
class HipsterVioletRabbit(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2014, 9, 10)  # Set Start Date
        self.set_cash(100000)  # Set Strategy Cash
        self.add_universe(self.my_coarse_filter_function, self.my_fine_fundamental_function)
        
        self.month = None

    def my_coarse_filter_function(self, coarse):
        return [c.symbol for c in coarse if c.dollar_volume > 1e7]

    def my_fine_fundamental_function(self, fine):
        tech = [x for x in fine if x.asset_classification.morningstar_sector_code == MorningstarSectorCode.TECHNOLOGY]
        
        unprofitable = [x for x in tech if x.financial_statements.income_statement.normalized_income_as_reported.three_months <= 0]
        
        sorted_revenue = sorted(unprofitable, key=lambda f: f.financial_statements.income_statement.total_revenue.one_month, reverse=True)
        
        return [f.symbol for f in sorted_revenue[:50]]


    def on_data(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.set_holdings(s, 1 / n_securities)