Overall Statistics
Total Orders
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Start Equity
100000
End Equity
100000
Net Profit
0%
Sharpe Ratio
0
Sortino 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
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
from AlgorithmImports import *

class ListQQQODTEOptions(QCAlgorithm):
    def initialize(self):
        # Set start and end dates
        self.set_start_date(2024, 11, 21)
        self.set_end_date(2024, 11, 21)
        # Set initial cash
        self.set_cash(100000)
        
        # Add QQQ equity and options
        self.qqq = self.add_equity("QQQ", Resolution.MINUTE)
        qqq_options = self.add_option("QQQ", Resolution.MINUTE)
        qqq_options.set_filter(lambda u: u.strikes(-999, 999))
        self.qqq_options_symbol = qqq_options.Symbol
        
        # Schedule the function to list 0DTE options at 3 PM
        self.schedule.on(self.date_rules.every_day(), self.time_rules.at(15, 0), self.list_o_d_t_e_options)
    
    def list_o_d_t_e_options(self):
        # Get QQQ price
        qqq_price = self.qqq.price
        if qqq_price == 0:
            return
        
        # Get the options chain
        chain = self.current_slice.option_chains.get_value(self.qqq_options_symbol)
        if chain is None or not list(chain):
            return
        
        # Get the current date
        today = self.time.date()
        
        # Filter for 0DTE options (expiring today)
        odte_options = [option for option in chain if (option.expiry.date() - today).days == 0]
        if not odte_options:
            self.log("No 0DTE options available.")
            return
        
        # Log the details of each 0DTE option
        for option in odte_options:
            self.log(f"Date: {today}, Expiration: {option.expiry.date()}, Price: {option.last_price}")
    
    def on_data(self, slice):
        pass