Hi,
I am trying to use SubscriptionDataSource.Rest to get data points at hourly resolution. As mentioned in the documentation
'When using SubscriptionTransportMedium.Rest the URL provided is polled at each Resolution time step and is assumed to be sufficient for 1-data point. This is generally intended for live data sources.'
But the api polling is happening at Daily timepoints regardless of what has been specified in the resolution.
Jared Broad
Please attach an example to reproduce your issue for assistance.
Does your data update hourly?
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.
Abhishek Gupta
Hi Jared,
Please find below the code snippet for this issue. The data is provided using rest api from database so for every timestamp whether its daily or hourly, api provides the corresponding bar. I expected the GetSource function to poll the api on hourly basis in below code snippet, but the execution comes to GetSource on daily frequency regardless of the resolution. In case, multiple bars could be parsed using the API, it would have solved the issue, but as mentioned in the document, only one data point should be provided through API.
class CustomDataStock(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 1, 1)
self.SetEndDate(2020, 1, 31)
self.SetCash(100000)
self.reso = Resolution.Hour
self.UniverseSettings.Resolution = self.reso
# Define the symbol and "type" of our generic data:
self.appleEquity = self.AddEquity("APPL", self.reso, Market.NSE,True,1,False).Symbol
self.apple = self.AddData(CustomStock, self.appleEquity, self.reso).Symbol
self.prices = []
class Stock(PythonData):
def GetSource(self, config, date, isLiveMode):
return SubscriptionDataSource("http://127.0.0.1:5678/AAPL/4/", SubscriptionTransportMedium.Rest)
Alexandre Catarino
Closing this thread for the moment since a related issue was opened in Lean:
SubscriptionDataSource.Rest Polling Daily for Hourly Resolution #4527
Abhishek Gupta
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!