Overall Statistics
Total Orders
60
Average Win
4.33%
Average Loss
-3.54%
Compounding Annual Return
2.025%
Drawdown
49.000%
Expectancy
0.160
Start Equity
100000
End Equity
107272.13
Net Profit
7.272%
Sharpe Ratio
0.126
Sortino Ratio
0.188
Probabilistic Sharpe Ratio
2.664%
Loss Rate
48%
Win Rate
52%
Profit-Loss Ratio
1.22
Alpha
0.022
Beta
0.194
Annual Standard Deviation
0.299
Annual Variance
0.089
Information Ratio
-0.132
Tracking Error
0.31
Treynor Ratio
0.194
Total Fees
$351.33
Estimated Strategy Capacity
$1000.00
Lowest Capacity Asset
CKX SUBW1BUUNHWL
Portfolio Turnover
0.36%
#region imports
from AlgorithmImports import *
#endregion
# https://quantpedia.com/Screener/Details/25


class SmallCapInvestmentAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2016, 1, 1)
        self.set_end_date(2019, 7, 1)
        self.set_cash(100000)

        self._year = -1
        self._count = 10

        self.universe_settings.resolution = Resolution.DAILY
        self._universe = self.add_universe(self._coarse_selection_function, self._fine_selection_function)

    def _coarse_selection_function(self, coarse):
        ''' Drop stocks which have no fundamental data or have low price '''
        if self._year == self.time.year:
            return Universe.UNCHANGED
        return [x.symbol for x in coarse if x.has_fundamental_data and x.price > 5]
 
    def _fine_selection_function(self, fine):
        ''' Selects the stocks by lowest market cap '''
        sorted_market_cap = sorted([x for x in fine if x.market_cap > 0],
            key=lambda x: x.market_cap)
        return [x.symbol for x in sorted_market_cap[:self._count]]

    def on_data(self, data):
        if self._year == self.time.year:
            return
        self._year = self.time.year

        weight = 1 / len(self._universe.selected)
        self.set_holdings([PortfolioTarget(symbol, weight) for symbol in self._universe.selected], True)