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
5.754
Tracking Error
0.071
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# region imports
from AlgorithmImports import *
# endregion

class TestAlgorithm(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2014,12,30)
        self.SetEndDate(2015,1,4)
        self.SetCash(300000)

        self.future = self.AddFuture(Futures.Indices.SP500EMini, Resolution.Minute, extendedMarketHours=True, dataNormalizationMode = DataNormalizationMode.Raw, dataMappingMode = DataMappingMode.OpenInterest, contractDepthOffset = 0)

        self.consolidator = TradeBarConsolidator(self.consolidation_period)
        self.consolidator.DataConsolidated += self.consolidation_handler
        self.SubscriptionManager.AddConsolidator(self.future.Symbol, self.consolidator)

    def consolidation_period(self, dt: datetime) -> CalendarInfo:
        # daily bar start time at 17:00
        dt = (dt if dt.hour > 17 else dt - timedelta(1)).date()
        start_dt = datetime(dt.year, dt.month, dt.day, 17, 0, 0)
        return CalendarInfo(start_dt, timedelta(hours=23, minutes=59, seconds=59))

    def consolidation_handler(self, sender, bar):
        self.Log("Bar high {} low {}".format(bar.High,bar.Low))