Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0.327
Tracking Error
0.186
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
#region imports
from AlgorithmImports import *
#endregion

class NadionTransdimensionalAutosequencers(QCAlgorithm):

    symbol_data_by_symbol = {}

    def Initialize(self):
        self.SetStartDate(2021, 9, 29)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        self.UniverseSettings.MinimumTimeInUniverse = timedelta(minutes=1)
        self.UniverseSettings.Resolution=Resolution.Daily
        self.SetUniverseSelection( QC500UniverseSelectionModel() )

        self.cohr = self.Symbol("COHR R735QTJ8XC9X")
        self.dre = self.Symbol("DRE R735QTJ8XC9X")
        
    def OnData(self, data):
        for kvp in data.Delistings:
            if kvp.Value.Type == DelistingType.Warning:
                continue
            symbol = kvp.Key
            if symbol in [self.cohr, self.dre]:
                self.Debug(f"Delisted {symbol} at {self.Time}")

    def OnSecuritiesChanged(self, changes):        
        for security in changes.AddedSecurities:
            self.symbol_data_by_symbol[security.Symbol] = 1

            if security.Symbol in [self.cohr, self.dre]:
                self.Debug(f"Added: {security.Symbol}")

        for security in changes.RemovedSecurities:
            symbol_data = self.symbol_data_by_symbol.pop(security.Symbol, None)
            if symbol_data is None:
                self.Debug(f"Popped None")
            if security.Symbol in [self.cohr, self.dre]:
                self.Debug(f"Removed: {security.Symbol}")

        self.Debug(f"ActiveSecurities: {len(self.ActiveSecurities)}; symbol_data_by_symbol {len(self.symbol_data_by_symbol)}")

        if len(self.symbol_data_by_symbol) != len(self.ActiveSecurities):
            a = set(list(self.symbol_data_by_symbol.keys()))
            b = set([s for s in self.ActiveSecurities.Keys])
            for symbol in list(a.difference(b)):
                self.Debug(f"{self.Time} - {symbol} is in symbol_data_by_symbol but not ActiveSecurities")