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
-2.229
Tracking Error
0.115
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
#region

using System;
using System.Linq;
using QuantConnect.Data;
using QCAlgorithmFramework = QuantConnect.Algorithm.QCAlgorithm;
using QCAlgorithmFrameworkBridge = QuantConnect.Algorithm.QCAlgorithm;

#endregion

namespace QuantConnect.Algorithm.CSharp
{
    public class SPXW : QCAlgorithm
    {
        private Symbol _spx;

        public override void Initialize()
        {
            SetStartDate(2023, 1, 1);
            SetCash(100000);

            var spxOptions = AddIndexOption("SPX", Resolution.Minute);
            spxOptions.SetFilter(-2, 2, TimeSpan.Zero, TimeSpan.FromDays(1));
        }

        public override void OnData(Slice data)
        {
            var endOfDay = new DateTime(Time.Year, Time.Month, Time.Day);

            if ((Time.Hour != 10) || (Time.Minute != 0)) return;

            if (!data.Bars.ContainsKey("SPX")) return;

            foreach (var chain in data.OptionChains.Values)
            {
                var expiringToday = (from p in chain select p.Expiry).Distinct().ToList();
                var expires = expiringToday.Aggregate("", (current, dt) => current + $"{dt:d} ");
                Log($"{Time} - {expires}");
            }
        }
    }
}