Overall Statistics
Total Trades
2
Average Win
0.07%
Average Loss
0%
Compounding Annual Return
-64.503%
Drawdown
8.800%
Expectancy
0
Net Profit
-6.484%
Sharpe Ratio
-4.22
Probabilistic Sharpe Ratio
9.522%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.275
Beta
0.33
Annual Standard Deviation
0.218
Annual Variance
0.047
Information Ratio
6.239
Tracking Error
0.433
Treynor Ratio
-2.785
Total Fees
$1.00
class VentralDynamicCircuit(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 2, 19)  # Set Start Date
        
        self.SetCash(100000)  # Set Strategy Cash
        self.AddEquity("SPY", Resolution.Minute)
        option = self.AddOption("SPY")
        option.SetFilter(-3, 3, timedelta(0), timedelta(7))
        self.contract = None
        

    def OnData(self, data):
        
        
        for chain in data.OptionChains:
            
            contracts = [contract for contract in chain.Value];
            
            puts = [contract for contract in contracts if contract.Right == OptionRight.Put]
            
            sortedPuts = sorted(puts, key=lambda p: p.Strike, reverse=False)
            
            sortedByExpiry = sorted(sortedPuts[:5], key=lambda p: p.Expiry, reverse=True)
            
            if self.contract == None:
                self.contract = sortedByExpiry[0]
                self.MarketOrder(self.contract.Symbol, -1)
                self.Debug(f"{self.contract.Symbol}, {self.contract.Strike}, {self.contract.Expiry}")
                
    
    def OnOrderEvent(self, orderevent):
        
        self.Debug(f"{self.Securities['SPY'].Close} with {orderevent}")