Hi,
In the rudimentary code below, I'm expecting to get a debug message printed every minute. However, it only prints a debug message at 00:00 every day. How can I get SelectCoarse() to run every minute? I tried a bunch of different variations but can't get coarse filter to run every minute.
class TestMinuteCoarseUniverseFilter(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 6, 1)
self.SetEndDate(2020, 6, 3)
self.SetCash(100_000)
self.UniverseSettings.Resolution = Resolution.Minute
self.UniverseSettings.ExtendedMarketHours = True
self.AddUniverse(self.SelectCoarse)
self.Debug("Beginning algo...")
def SelectCoarse(self, coarse):
self.Debug(f"Entered SelectCoarse at {self.Time}.")
return []
Log output:
2020-06-01 00:00:00 :Beginning algo...2020-06-01 00:00:00 :Entered SelectCoarse at 2020-06-01 00:00:00.2020-06-02 00:00:00 :Entered SelectCoarse at 2020-06-02 00:00:00.2020-06-03 00:00:00 :Entered SelectCoarse at 2020-06-03 00:00:00.
Derek Melchin
Hi N Renzoni,
Please clarify the goal of this algorithm. Since Coarse Fundamental data is created with daily data, the values don't change during the day.
Best,
Derek Melchin
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.
N Renzoni
Hi Derek, thanks for responding.
My goal is to filter my universe to stocks that traded the most dollar-volume before 9:30am EST. I figured I would use a simple time check in the SelectCoarse function. I also tried with the SelectFine function but it too only gets called once a day.
Is there any way to go about this?
If not, I could use my own data source for this, but I collect the data manually which isn't ideal. It would be nice to have it automated.
Thanks
Derek Melchin
Hi N Renzoni,
The universe data is only generated daily. See these docs for reference.
Please see this related thread for discussion on universe selection with cumulative intraday volume.
Best,
Derek Melchin
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.
N Renzoni
Thank you Derek, the code you posted in the linked thread is what I was looking for. (Would be nice if QuantConnect had a built in API for doing minute universe filtering intra-day.) Thanks for the help!
Derek Melchin
Hi N Renzoni,
self.UniverseSettings.Resolution = Resolution.Minute
is the resolution of the securities selected by SelectCoarse.
The SelectCoarse method itself is only called on a daily basis. See the docs here. It's not currently possible to increase the frequency of which SelectCoarse is called. However, we have a GitHub Issue open to have this functionality added. Subscribe to this issue to be notified of our progress.
Best,
Derek Melchin
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.
N Renzoni
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!