Annualized Return when time interval is 0 Years?

From the given link for calculating annualized return :- Annualized Return
the equation is as:
annualized_returns = (1 + total_returns) ^ (1 / timeInterval_in_years) - 1
But when the purchaseDate and endDate are in the same years, then we will get the timeInterval_in_years as zero. And in that case we will get the annualized_returns value as “INFINITY”,
because 1/0 = Infinity, so what we are supposed to do in that case? Which formula to be used when timeInterval is 0 Years?

As for example i am getting an output for one of such case as:
[{“symbol”:“AAPL”,“annualizedReturn”:“Infinity”,“totalReturns”:0.3012460455807349} ]
where the annualizedReturn is clearly seems to be Infinity, so how can we resolve that?

Go through this article and find your answer :slight_smile:

*Mark It solved so that others can see it!

2 Likes

Will annualized return be 0 if number of days = 0 ?