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.06
Tracking Error
0.436
Treynor Ratio
0
Total Fees
$0.00
class NadionTachyonProcessor(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 11, 4)
        self.SetCash(100000)
        self.AddEquity("SPY", Resolution.Minute)
        self.rolling_window = RollingWindow[TradeBar](30)


    def OnData(self, slice):
        if "SPY" not in slice.Bars:
            return
        
        if not self.rolling_window.IsReady:
            self.rolling_window.Add(slice['SPY'])
            return
        
        self.openingBar = self.rolling_window[self.rolling_window.Count-1]
        self.secondaryBar = self.rolling_window[0]

        if (self.secondaryBar.Close > self.openingBar.High) and (self.openingBar.High>self.secondaryBar.Low>self.openingBar.High):
            price = self.openingBar.Low
        elif (self.secondaryBar.Close < self.openingBar.Low) and (self.openingBar.High>self.secondaryBar.High>self.openingBar.High):
            price = self.openingBar.High
        else:
            return
        
        """
        if not self.Portfolio.Invested:
            for kvp in slice.OptionChains:
            if kvp.Key != self.option_symbol: continue
            chain = kvp.Value
           
            contracts = sorted(sorted(sorted(chain, \
                key = lambda x: abs(chain.Underlying.Price - x.Strike)), \
                key = lambda x: x.Expiry, reverse=True), \
                key = lambda x: x.Right, reverse=True)
                
            # Select contract
            
            # Submit contract order
        """
        

    def OnEndOfDay(self):
        self.rolling_window.Reset()