It is my understanding QC supports 0DTE SPXW.
As a result I would expect to see same day expirations for every trading day (i.e. expire by EOD, not the next morning).
The code sample:
1 - Filters all options that expire the same day
2 - At 10am of each day that has 0DTEs, it prints the expiration date
The result shows for 2023:
Execution Date - Expiration Date
1/19/2023 10:00:00 AM - 1/20/2023
2/16/2023 10:00:00 AM - 2/17/2023
3/16/2023 10:00:00 AM - 3/17/2023
4/20/2023 10:00:00 AM - 4/21/2023
5/18/2023 10:00:00 AM - 5/19/2023
6/15/2023 10:00:00 AM - 6/16/2023
7/20/2023 10:00:00 AM - 7/21/2023
What am I doing wrong / missing?
Mia Alissi
Based on the provided code, it seems like you are trying to filter for SPX index options that expire on the same day. However, the expiration dates you are seeing are for the next day, not the current day.
The issue might be related to the timezone. QuantConnect's time is in UTC, and the US market operates in the Eastern Time zone. Therefore, when it's 10 AM in UTC, it's actually 5 AM or 4 AM (depending on daylight saving) in Eastern Time, which is before the market opens. This could explain why you are seeing options that expire the next day instead of the same day.
To fix this, you could adjust the time you are checking for same-day expiration options to a time when the US market is open. For example, you could change the time check in your
OnData
method to a time later in the day:This will check for same-day expiration options at 2:30 PM UTC, which is 9:30 AM Eastern Time when the market opens.
Please note that this is just a suggestion based on the provided information and might not completely solve your issue. If the problem persists, I would recommend reaching out to the QuantConnect community for further assistance.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Michael V
Hi Mia - thank you for the quick reply.
The expiration shows as midnight in the Contract object, i.e. 1/20/2023 00:00:00
If you change this:
spxOptions.SetFilter(-2, 2, TimeSpan.Zero, TimeSpan.FromDays(1));
to:
spxOptions.SetFilter(-2, 2, TimeSpan.Zero, TimeSpan.FromDays(30));
You can see it only shows monthly contracts.
The code does not filter the available expiration dates.
Execution Date - Expiration Date(s)
1/3/2023 10:00:00 AM - 1/20/2023
1/4/2023 10:00:00 AM - 1/20/2023
1/5/2023 10:00:00 AM - 1/20/2023
1/6/2023 10:00:00 AM - 1/20/2023
1/9/2023 10:00:00 AM - 1/20/2023
1/10/2023 10:00:00 AM - 1/20/2023
1/11/2023 10:00:00 AM - 1/20/2023
1/12/2023 10:00:00 AM - 1/20/2023
1/13/2023 10:00:00 AM - 1/20/2023
1/17/2023 10:00:00 AM - 1/20/2023
1/18/2023 10:00:00 AM - 1/20/2023 2/17/2023
1/19/2023 10:00:00 AM - 1/20/2023 2/17/2023
1/20/2023 10:00:00 AM - 2/17/2023
1/23/2023 10:00:00 AM - 2/17/2023
1/24/2023 10:00:00 AM - 2/17/2023
1/25/2023 10:00:00 AM - 2/17/2023
1/26/2023 10:00:00 AM - 2/17/2023
1/27/2023 10:00:00 AM - 2/17/2023
1/30/2023 10:00:00 AM - 2/17/2023
Mia Alissi
Based on the provided information, it seems like the
SetFilter
method is not filtering the options contracts as expected. This method is used to filter the option contracts that the algorithm receives data for, based on their expiration dates and strike prices.In your case, you are trying to filter for options that expire within 30 days. However, the results you are seeing are only showing monthly contracts, not the expected range of expiration dates.
The
SetFilter
method takes four arguments: the minimum and maximum strike price relative to the underlying price, and the minimum and maximum expiration time. In your case, you are setting the minimum expiration time to zero and the maximum expiration time to 30 days:This should return all options contracts that expire within the next 30 days. However, it seems like it's only returning the monthly contracts.
One possible reason for this could be that the SPX index options only have monthly expirations. If this is the case, then the
SetFilter
method is working as expected, as it's only returning the available contracts.If you expect there to be options contracts with other expiration dates, then there might be an issue with the data or the filtering method. In this case, I would recommend reaching out to the QuantConnect community for further assistance.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Alexandre Catarino
Hi,
For 0DTE SPXW index options, we need to add the following code:
Best regards,
Alex
Michael V
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!