Back

How to get custom alpha model to once per day

Hello,

     I'm trying to get my Framework Algorithm to download a file once a day from Dropbox and use the signals in that file to create Insights.  It would be quite simple to create an array of Insights based on the text downloaded from Dropbox and return it.  This means I only want to generate my insights once per day (ideally before market open), but I need minutely data for my ExecutionModel.   Since I have set my resolution to minutely data, this means that my Update method in my AlphaModel runs every minute, which would cause me to re-download my signal file every minute in live trading.  

Is it possible to make it so that my AlphaModel only Updates once during the day, even if my resolution has been set to minutely in my algorithm?

Update Backtest







You can create a class variable, e.g.: self.day, and use it to control the file download:

def __init__(self):
self.day = 0

def Update(self, algorithm, slice):
if self.day != algorithm.Time.day:
self.day = algorithm.Time.day
# download file

Alternatively, you can use ScheduledUniverseSelectionModel (see example) to download the file and select the securities that will have insights. This algorithm design will properly separate the concerns. 

1

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.


Thank you Alexandre!  This solves the issue I was having in another thread (which you also respoded to, thank you!)

https://www.quantconnect.com/forum/discussion/4898/how-to-use-nullalphamodel/p1

0

Update Backtest





0

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.


Loading...

This discussion is closed