Back

Backtesting Entry Prior to Earnings Date

I am trying to put together a universe that filters for the equities with an upcoming earnings date x days away. My code is below and shown for the day before (-1). I keep receiving the following error:

Runtime Error: The added or subtracted value results in an un-representable DateTime. Parameter name: value

Is it possible to do this? What am I missing here?

public IEnumerable<Symbol> FineSelectionFunction(IEnumerable<FineFundamental> fine)
{
return fine.Where(x =>

// Filter for equities with earnings in x number of days
Time == x.EarningReports.FileDate.AddDays(-1) &&

// Invalid FileDate
x.EarningReports.FileDate != new DateTime())

.Take(1).Select(x => x.Symbol);
}
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 Chris. The data field EarningsReports.FileDate returns the last 10-Q report filing date. Currently, it is not possible to select add/remove stocks to a universe based on upcoming 10-Q filing date.

 

However, you can select stocks to your universe that have recently released their 10-Q report as discussed in this community post. The reason for the error message you are receiving is:Time == x.EarningReports.FileDate.AddDays(-1)

The algorithm should run if you add days to FileDate:   

 

Time == x.EarningReports.FileDate.AddDays(1)

For further information on fundamental data, check out this documentation section on Fundamentals.

 

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.


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