Backtesting Entry Prior to Earnings Date

Back

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

Is there only data for the most recent earnings date or does the data have multiple earnings dates back?

0

Hi Mary,

On one iteration of a fine filter, there are multiple Earnings fields that can range from 1 month to twelve months. However, we can store past earnings values in a RollingWindow, and we demonstrate the use of RollingWindows with Fundamental data in our G-Score Factor investing Strategy Library addition.

Best,
Shile Wen 

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...

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!