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.048
Tracking Error
0.164
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
class LogicalVioletSeahorse(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 3, 1)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        self.AddEquity("SPY", Resolution.Minute)
        
        self.AddAlpha(MyAlphaModel())

class MyAlphaModel(AlphaModel):
    last_consolidation_time = None
    minute = 0
    
    def Update(self, algorithm, data):
        if self.last_consolidation_time is not None and self.minute != self.last_consolidation_time.minute:
            self.minute = self.last_consolidation_time.minute
            return [Insight.Price("SPY", timedelta(minutes=10), InsightDirection.Up)]
        
        return []
        
    def consolidation_handler(self, sender, bar):
        self.last_consolidation_time = bar.Time
        
    
    def OnSecuritiesChanged(self, algorithm, changes):
        for security in changes.AddedSecurities:
            self.consolidator = TradeBarConsolidator(timedelta(minutes=20))
            self.consolidator.DataConsolidated += self.consolidation_handler
            algorithm.SubscriptionManager.AddConsolidator(security.Symbol, self.consolidator)
        
        for security in changes.RemovedSecurities:
            pass