trophy

Long Only, ETF Alpha Streams Competition with $27,500 Prize Pool

Back

How to define a security to use based on date/time?

I want the algo to use different 'world small cap' ETFs based on date. For example: 'EFA' before '7/1/2008', 'SCZ' from '7/1/2008' to '12/31/2011' and 'VSS' from '1/1/2012. I am new to quantconnect and any help is appreciated.

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.


Hi Sanjay, the self.Time property can be useful for this algorithm. The self.Time property is the point in time in which the backtest currently is. One idea could be to check the algorithm's self.Time with a datetime object like the backtest below:

You can confirm when the conditional statements are satisfied by looking at the debug statements and the timestamps. Good luck!

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