Hello, I creating an initial test algorithm to get the feeling of QuantConnect.
I am specifically looking for minute bars for the last 2-3 weeks. For this, I added the start and end in the initialize step. However, the algorithm seeing to go back to 2023-10-24 and start my simple algorithm. How do i get the minute data for the last 1-3 weeks are so? I assumed this is not available in Free trail. So I just became a researcher (with out extra compute) , but still the algo still starts on 2023-10-24. Any help is appreciated?
self.SetStartDate(2024, 1, 19) # Set Start Date
self.SetEndDate(2024, 1, 19) # Set End Date
Mia Alissi
To get minute data for the last 2-3 weeks, you need to set the start and end dates correctly in the
Initialize
method. However, there seems to be a mistake in your code. You have set the start and end dates to be the same, which means the algorithm will only consider data for that specific day.To get data for a period of 2-3 weeks, you should set the start date to be 2-3 weeks before the end date. For example, if you want data from January 1, 2024 to January 19, 2024, you should set the dates like this:
Also, make sure you have added the required security with the correct resolution. For minute data, you should add the security with
Resolution.Minute
. For example:This will ensure that you're receiving minute data for the SPY asset.
Please note that the availability of minute data is not related to your subscription level. Both free users and paid users have access to the same data in QuantConnect.
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.
Santosh Kalakonda
Hi Mia,
Thanks for the response.
Here is what I am trying to ask. If you look my start and end dates, they are properly initialized. But my first debug point in onData starts at 2023/10/26, 9:31 am EST (Look at the watch window). Why it doesn't start from 2024/1/19 as I initialized?
Mia Alissi
Based on the information provided in the extracts, it's difficult to determine the exact cause of the issue you're experiencing. However, there could be a few reasons why the
OnData
method is not starting from the date you specified:There might be an issue with the data for the specific start date you've set. If there's no data available for that date, the algorithm might start from the next available date.
The algorithm might be in a "warm-up" period. During this period, the algorithm is fed historical data to prepare indicators or other computations. If you've set a warm-up period, the
OnData
method will start receiving data after this period.There might be a bug or issue in your code that's causing the algorithm to start from a different date.
Without seeing the full code of your algorithm, it's hard to provide a more specific answer. I would recommend checking your code for any of the issues mentioned above.
If you're still having trouble, you might find it helpful to post a question on the QuantConnect Forum. The community there might be able to provide more specific help based on your code.
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.
Santosh Kalakonda
Here is the code. Could someone help tell why onDate starts on 2023/10/26 instead of 2024/1/19
from AlgorithmImports import *
# endregion
class EnergeticLightBrownPenguin(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2024, 1, 19) # Set Start Date
self.SetEndDate(2024, 1, 20) # Set End Date
self.SetCash(1000000) # Set Strategy Cash
#self.UniverseSettings.Resolution = Resolution.Minute
#self.spy = self.AddEquity('SPY', Resolution.Minute).Symbol
self.AddEquity("SPY", Resolution.Minute)
self.AddEquity("BND", Resolution.Minute)
self.AddEquity("AAPL", Resolution.Minute)
def OnData(self, data: Slice):
if not self.Portfolio.Invested:
self.SetHoldings("SPY", 0.33)
self.SetHoldings("BND", 0.33)
self.SetHoldings("AAPL", 0.33)
self.Debug(f"Self Time is {self.Time}")
Mia Alissi
Based on the provided code and the information from the extracts, it's not immediately clear why the
OnData
method starts at "2023/10/26" instead of "2024/1/19". Your code seems to be correctly setting the start and end dates.However, there are a few things you could check:
Data Availability: Ensure that there is data available for "SPY", "BND", and "AAPL" for the date range you've specified. If there's no data available for the start date, the algorithm might start from the next available date.
Warm-Up Period: Check if there's a warm-up period set somewhere else in your code. During the warm-up period, the algorithm is fed historical data to prepare indicators or other computations. If a warm-up period is set, the
OnData
method will start receiving data after this period.Data Subscription: Ensure that the data subscription for the securities is correctly set to
Resolution.Minute
.If you're still having trouble, I recommend posting your question on the QuantConnect Forum. The community there might be able to provide more specific help based on your code.
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.
Santosh Kalakonda
The algorithm is plan simple. It should have everything that's needed.
Could someone let me know if we need to join higher tier to get access to very recent minute data?
I have already subscribed for Reseacher tier, and I still don't get Minute data.
Could this issue be forwarded internally for further assistance?
Mia Alissi
Access to minute-level data is not restricted to higher tiers. Both free users and paid users have access to the same data in QuantConnect. The issue you're experiencing is likely not related to your subscription level.
As per the information provided in the extracts, for minute resolution, you can access 1 year of historical data. If your algorithm relies on a longer history, this could indeed affect your backtest results.
If you're still having trouble, it might be a technical issue. I recommend reaching out to the QuantConnect support team for further assistance. You can do this by requesting private support as a member of the Quant Researcher tier.
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.
Santosh Kalakonda
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!