Overall Statistics
Total Trades
1155
Average Win
0.00%
Average Loss
0.00%
Compounding Annual Return
-2.602%
Drawdown
1.400%
Expectancy
-0.822
Net Profit
-1.313%
Sharpe Ratio
-6.437
Probabilistic Sharpe Ratio
0.000%
Loss Rate
93%
Win Rate
7%
Profit-Loss Ratio
1.53
Alpha
-0.021
Beta
-0.003
Annual Standard Deviation
0.003
Annual Variance
0
Information Ratio
-1.38
Tracking Error
0.105
Treynor Ratio
7.36
Total Fees
$1155.00
class TachyonDynamicPrism(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 9, 2)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddUniverse(self.SelectCoarse)
        
        # Dictionary keyed by symbol and will hold SymbolData objects
        self.symboldict = {}
        
    def SelectCoarse(self, coarse):
        # Get top 1000 liquid symbols
        sortedCoarse = sorted(coarse, key=lambda c:c.DollarVolume, reverse=True)
        liquidSymbols = sortedCoarse[:1000]
        
        # Get symbols we need to initialize
        symbols = [c.Symbol for c in liquidSymbols if c.Symbol not in self.symboldict]
        
        # 1 day history call for symbols that we need to initialize
        history = self.History(symbols, 1, Resolution.Daily)
        
        if not history.empty:
            history = history.close.unstack(0)
            
            for symbol in symbols:
                if str(symbol) not in history:
                    continue
                
                df = history[symbol].dropna()
                
                if not df.empty:
                    # Create SymbolData object and store in dictionary
                    self.symboldict[symbol] = SymbolData(symbol, df)
        
        # Update daily returns
        for c in coarse:
            symbol = c.Symbol
            if symbol in self.symboldict:
                self.symboldict[symbol].Update(c.AdjustedPrice)

        # filter for symbols with more than 10% gains since last close
        filteredSymbols = [symbol for symbol, data in self.symboldict.items() if data.IsReady and data.dailyReturn > 0.10]
        
        return filteredSymbols
        
    
    def OnSecuritiesChanged(self, changes):
        
        for security in changes.AddedSecurities:
            symbol = security.Symbol
            # Buy 1 share if security is added to our universe
            self.MarketOrder(symbol, 1)
        
        for security in changes.RemovedSecurities:
            symbol = security.Symbol
            # Liquidate if security removed from universe
            self.Liquidate(symbol)

class SymbolData:
    
    def __init__(self,  symbol, history):
        self.symbol = symbol
        self.dailyReturn = -1
        self.lastClose = -1
        
        # initialize last close with historical data
        for time, close in history.iteritems():
            self.lastClose = close
        
        
    
    def Update(self, close):
        self.dailyReturn = (close - self.lastClose)/self.lastClose
        self.lastClose = close
        
    @property
    def IsReady(self):
        return self.dailyReturn != -1 and self.lastClose != -1