Hey all!
Ever wanted to fetch symbols to trade each day from a remote server? Maybe you have a file uploaded to dropbox each day, or can call a web service to get a list of symbols to trade for the day. This is now all possible using our newest feature: universe selection!
In the attached algorithm I show how you can add a universe that will look to dropbox for both backtesting and live modes. This is all done through the AddUniverse method which is how we define a new universe. The general idea behind all of the AddUniverse methods is that they define how you choose your symbols. The main argument to these methods is a selection function that returns the symbols to be traded. Have a look at this example: AddUniverse("my-universe-name", Resolution.Daily, dateTime => {
return new List
});
Now the example above is simple and contrived, but I think it shows some important things. First off, we give our universe a unique name, then we specify that this universe should 'fire' on a daily resolution, that is, at midnight on trading days. The final argument is our selection function that accepts a DateTime as the argument and returns an IEnumerable
So in this example, our selection function will be called each trading day at midnight and will return the list of symbols that we want to trade for the next day! The engine will handle getting you all the data you need and will never remove data if you have open orders or open positions!
Check out the attached demo algorithm and let us know what you think!!
Daniel Hai
Michael Handschuh
Daniel Hai
Michael Handschuh
// the dateTime parameter in the universe function is the local time this is being triggered // in this case, midnight NYC time AddUniverse("my-universe-name", Resolution.Daily, dateTime => { return new List{"SPY", "GOOG"};
});
The 'dateTime' parameter in the universe selection function will be the local universe time at the point of trigger, which in the Resolution.Daily case will be 12:00AM NYC time (EST/EDT). To answer your question more directly, if something triggers 'at midnight' or 'on the hour' or 'on the minute' - it means it will reach your algorithm ~10 milliseconds after 'midnight'/'hour'/'minute'. Hope this helps!Michael Handschuh
Eliot Gable
Jared Broad
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.
Riley O'Shea
Michael Handschuh
Riley O'Shea
Michael Handschuh
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!