Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

Currently, I'm implementing a feature of an open source project (https://github.com/yccheok/jstock/issues/7), which requires me to calculate the rate of return of a stock.

Let's take the following scenario.

User purchased 1000 units stock with unit price 1 dollar at 1st January 2013. He didn't perform any sell transaction & buy transaction in between. At 31st December 2013, the stock price reached 2 dollar.

The rate of return of the stock for year 2013 is 100%

(Value of investment at 31st December 2013 - Cost of investment at 1st January 2013) / (Cost of investment at 1st January 2013) * 100%

(1000 * $2 - 1000 * $1) / (1000 * $1) * 100% = 100%

But, what if the user had purchased another 1000 units of same stock with unit price 1 dollar at 1st March 2013. What should be the rate of return of the stock for year 2013?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

That is what XIRR does or can you read this answer.

Basically it tries to find an interest rate that works out to the same numbers.

I think Excel and Google Docs use the Newton approximation

http://www.mftransparency.org/calculating-interest-rates-using-newtons-method/

There's also a java implementation available on github called jxirr.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.