How to resolve the Extrapolated Annualized Returns error. Tried everything, nothing works

The error is -> com.crio.warmup.stock.portfolio.PortfolioManagerTest > calculateExtrapolatedAnnualizedReturn() FAILED

I’ve tried everything in the forum but nothing is working.
The stacktrace shows -> expected <0.814> but is <0.75>
I’m sure that i’m calculating everything correctly and the values passed are also correct (i’ve verified everything by going to the URL of the API call). What to do.

@Akash24

As the error is suggesting, something is wrong with your calculation part.

Maybe there is some problem with your calculated time, coz there are lots of formulas of it online.

Try them all, The problem will get resolved :slight_smile:

For this error, just try and verify the following -

  • make sure that you have no hardcoded any values.
  • Calculation is important, make sure you have used the correct formula and calculation logic is correct.
  • Also, make sure you have sorted your stocks according to the decreasing order of annualized Returns

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, please feel free to create a new topic and post this question as a reference link in the description of the new topic.