Hey everyone, do we have minute-level historical option data? If so, could someone kindly share your code for retrieving it?
I'm interested in developing and back-testing an options trading algorithm with the following steps:
- On any given day, fetch SPY option data from 9:30 AM EST to 3:30 PM EST, covering a total of 360 minutes, and then apply some processing logic.
- Execute an SPY Iron Condor trade 30 minutes before the market closes and close the trade at the end of the trading day.
Mia Alissi
Yes, QuantConnect does provide minute-level historical option data. You can use the
GetOptionHistory
method to fetch this data. Here is an example of how you can do this in Python:This code fetches the option history for a given equity symbol for the last two days at a minute-level resolution. You can adjust the
end_time
andtimedelta
parameters to fetch data for your desired time period.For your Iron Condor strategy, you can refer to the Iron Condor demonstration algorithm provided in the QuantConnect documentation. Here are the Python versions of the algorithm:
You can modify these algorithms to fit your specific trading strategy. For example, you can adjust the algorithm to execute the Iron Condor trade 30 minutes before the market closes and close the trade at the end of the trading day.
Sources:
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.
Stanley Zheng
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!