Overall Statistics
Total Trades
36
Average Win
0.15%
Average Loss
-0.09%
Compounding Annual Return
38.220%
Drawdown
1.400%
Expectancy
0.182
Net Profit
1.070%
Sharpe Ratio
3.348
Probabilistic Sharpe Ratio
64.383%
Loss Rate
57%
Win Rate
43%
Profit-Loss Ratio
1.76
Alpha
-0.027
Beta
0.465
Annual Standard Deviation
0.084
Annual Variance
0.007
Information Ratio
-4.279
Tracking Error
0.089
Treynor Ratio
0.602
Total Fees
$39.50
from universe_selection_model import MyUniverseModel
class TestAlgo(QCAlgorithm):

    def Initialize(self):

        self.SetStartDate(2018, 5, 28)
        self.SetEndDate(2018, 6, 9)
        self.SetCash(100000)
        # Universe selection settings
        self.UniverseSettings.Resolution = Resolution.Minute
        self.SetUniverseSelection(MyUniverseModel())
        self.day = 0
        
    def OnSecuritiesChanged(self, changes):
        self.changes = changes
        for security in changes.RemovedSecurities:
            if security.Invested:
                self.Liquidate(security.Symbol, 'Removed from Universe')
        
    def OnData(self, data):
        if data.Time.day == self.day:
            return
        self.day = data.Time.day
        
        if self.changes is not None:
            for security in self.changes.AddedSecurities:
                if self.CurrentSlice.ContainsKey(security.Symbol):
                    self.SetHoldings(security.Symbol, 0.1)
        self.changes = None
from Selection.FundamentalUniverseSelectionModel import FundamentalUniverseSelectionModel

class MyUniverseModel(FundamentalUniverseSelectionModel):

    def __init__(self):
        super().__init__(False)

    def SelectCoarse(self, algorithm, coarse):
        
        sortedByDollarVolume = sorted(coarse, key=lambda c: c.DollarVolume, reverse=True)
        symbols_by_price = [c.Symbol for c in sortedByDollarVolume if c.Price > 10]
        algorithm.filteredByPrice = symbols_by_price[:8]
        return algorithm.filteredByPrice

    def SelectFine(self, algorithm, fine):
        return [f.Symbol for f in fine]