Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
-36.966%
Drawdown
10.100%
Expectancy
0
Net Profit
-7.972%
Sharpe Ratio
-1.957
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.333
Beta
-4.997
Annual Standard Deviation
0.22
Annual Variance
0.048
Information Ratio
-2.045
Tracking Error
0.22
Treynor Ratio
0.086
Total Fees
$1.74
import numpy as np

class Consolidate(QCAlgorithm):
  

    def Initialize(self):
        self.SetStartDate(2018,10, 7)  #Set Start Date
        self.SetEndDate(2018,12,11)    #Set End Date
        self.SetCash(100000)           #Set Strategy Cash
        self.AddEquity("SPY", Resolution.Minute)
        consolidator = TradeBarConsolidator(10)
        consolidator.DataConsolidated += self.OnDataConsolidated
        self.SubscriptionManager.AddConsolidator("SPY", consolidator)
        self.tradeBarWindow = RollingWindow[TradeBar](3)

    def OnDataConsolidated(self, sender, bar):
        self.tradeBarWindow.Add(bar)
        self.Log(self.tradeBarWindow[0])
        
    def OnData(self, data):
        if not self.Portfolio.Invested:
            self.SetHoldings("SPY", 1)