Overall Statistics
Total Trades
10
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
Tracking Error
0
Treynor Ratio
0
Total Fees
$21.50
Estimated Strategy Capacity
$48000000.00
Lowest Capacity Asset
ES Y6URRFPZ86BL
Portfolio Turnover
1958.68%
# region imports
from AlgorithmImports import *
# endregion

class FuturesPriceExample(QCAlgorithm):
    
    def Initialize(self):
        self.SetStartDate(2023, 1, 5)
        self.SetEndDate(2023, 1, 5)
        self.SetCash(100000)

        self.ES_contract = self.AddFuture(Futures.Indices.SP500EMini, Resolution.Minute, contractDepthOffset = 0)


    def OnData(self, data):

        bar_symbol = data.Bars[self.ES_contract.Symbol]
        # bar_mapped = data.Bars[self.ES_contract.Mapped]

        # Buy 5 contracts, 1 per minute starting at 9:00
        if self.Time.hour == 10 and self.Time.minute < 5:
            market_order = self.MarketOrder(self.ES_contract.Mapped, 1)
            self.Debug("{} {}".format(self.Time, (str(bar_symbol))))
            # self.Debug("{} {}".format(self.Time, (str(bar_mapped))))
            self.Debug("{} {}".format(self.Time, (str(market_order))))
            
        # Sell 5 contracts, 1 per minute starting at 10:00
        if self.Time.hour == 11 and self.Time.minute < 5:
            market_order = self.MarketOrder(self.ES_contract.Mapped, -1)
            self.Debug("{} {}".format(self.Time, (str(bar_symbol))))
            # self.Debug("{} {}".format(self.Time, (str(bar_mapped))))
            self.Debug("{} {}".format(self.Time, (str(market_order))))
                 

    def OnOrderEvent(self, orderEvent):
        if orderEvent.Status == OrderStatus.Filled:
            self.Debug("{} {}".format(self.Time, (str(orderEvent))))