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
-2.773
Tracking Error
0.139
Treynor Ratio
0
Total Fees
$0.00
class FatSkyBlueBull(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 1, 1)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddUniverse(self.Universe.DollarVolume.Top(1))
        self.AddAlpha(MyAlpha(self))


class MyAlpha(AlphaModel):
    schedule_symbol = None
    scheduled_event = None
    symbols = []
    
    def __init__(self, algorithm):
        self.algo = algorithm
    
    def Update(self, algorithm, data):
        return []
        
    def AtOpen(self):
        self.algo.Log(f"AtOpen called at {self.algo.Time} through {self.schedule_symbol}")
    
    def OnSecuritiesChanged(self, algorithm, changes):
        
        for security in changes.RemovedSecurities:
            symbol = security.Symbol
            self.symbols.remove(security.Symbol)
            if symbol == self.schedule_symbol:
                # Remove scheduled event
                algorithm.Schedule.Remove(self.scheduled_event)
                self.scheduled_event = None
                self.schedule_symbol = None
            
        for security in changes.AddedSecurities:
            symbol = security.Symbol
            self.symbols.append(symbol)
            if self.schedule_symbol is None:
                # Add Scheduled event
                self.scheduled_event = algorithm.Schedule.On(algorithm.DateRules.EveryDay(symbol), algorithm.TimeRules.AfterMarketOpen(symbol, 1), self.AtOpen)
                self.schedule_symbol = symbol