Was wondering if anyone can point me to an open source java quant library that provides implementation for Excel Price and Yield functions.
Thanks, Tapasvi
Was wondering if anyone can point me to an open source java quant library that provides implementation for Excel Price and Yield functions.
Thanks, Tapasvi
You may want to have a look at QuantLib. It's a free/open source library for quantitative finance.
The Excel PRICE function is a simple sum of discounted cash flows, discounted assuming a flat zero rate discounting curve. It is documented here: Excel Help / PRICE.
I wrote a small Java version of the function, which I am posting below. The Java version just takes a "time to maturity" and does not support different daycountings, while the Excel PRICE function takes a settlement date and maturity date and supports different daycountings. However, you can attribute for the different daycountings by converting the coupon. Note also that the Excel function has a strange hardcoded notional of 100 in front of the coupon.
An Excel sheet benchmarking the two implementations can be downloaded here. The sheet requires "Obba".
The Excel YIELD function is just a Newton solver applied to the PRICE function, see Excel Help / YIELD. A Java implementation of the Newton solver can be found at finmath.net.