Error in calculate Annualized Return No Data On EndDate in module 4

@anand-crio sir What should i check to pass this calculateAnnualizedReturnNoDataOnEndDate() test case ?

Hi @Jitender,

I can only speculate about a possibility as I’m not yet in Module 4.

From the method name, it seems like we have to account for the case when no end date is provided for finding the Annualized Return. In that case, one possibility would be to take the most recent stock data available for that stock.

If the data is not available for the enddate specified then from the List most recent stock has to be taken
Hint: Data for the start date or for the date closest to start date will be stored at the index 0 of the list ,
Now i think you can determine the same for endDate.

Hey @Jitender, For No Data On EndDate you have to take last date nearest to endDate which can be found at last index of a sorted (ascending order) List. Right?

Thankx kunal this works for me.