Overall Statistics
Total Orders
1844
Average Win
0.28%
Average Loss
-0.18%
Compounding Annual Return
10.873%
Drawdown
61.300%
Expectancy
0.765
Start Equity
100000
End Equity
277953.38
Net Profit
177.953%
Sharpe Ratio
0.345
Sortino Ratio
0.397
Probabilistic Sharpe Ratio
1.131%
Loss Rate
32%
Win Rate
68%
Profit-Loss Ratio
1.58
Alpha
-0.008
Beta
1.343
Annual Standard Deviation
0.272
Annual Variance
0.074
Information Ratio
0.093
Tracking Error
0.195
Treynor Ratio
0.07
Total Fees
$2479.62
Estimated Strategy Capacity
$3000.00
Lowest Capacity Asset
UTSI RSQ0CRVRG485
Portfolio Turnover
0.43%
# 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)