NPV and Zero Curve

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

NPV and Zero Curve

gigifaye29
Hello,

I have two questions and would appreciate your help.

1. I am wondering if Quantlib currently has the functionality to take a vector of irregular cash flows, a vector of dates on which those CFs occur, and a vector of zero rates obtained from interpolation and bootstrapping as parameters, and then calculate the present value of the CFs.

2. I understand Quantlib has the interpolation and curve fitting methods that allow us to create a curve given   key rates. I managed to generate a zero-curve based on this. However, I am wondering if Quantlib is able to return me zero rates on any points on the zero-curve(those not falling exactly on the key dates I used as input)? For example, I used T-rates on Jan1,2008, Feb1,2008, Mar 1, 2008.... to build the zero-curve, but I would want to get zero-rates on Feb25,2008, for example.

Thanks a lot in advance,
Xin

Reply | Threaded
Open this post in threaded view
|

Re: NPV and Zero Curve

Luigi Ballabio
Hi Xin,

On Fri, 2008-03-07 at 06:32 -0800, gigifaye29 wrote:
> 1. I am wondering if Quantlib currently has the functionality to take a
> vector of irregular cash flows, a vector of dates on which those CFs occur,
> and a vector of zero rates obtained from interpolation and bootstrapping as
> parameters, and then calculate the present value of the CFs.

Yes.  First, you'll have to use each cash-flow and the corresponding
date to create instances of the SimpleCashFlow class. You'll store the
cashflows in a vector to shared_ptr<CashFlow>.  Second, you'll have to
use the zero rates to create an interpolated yield term structure.  Once
you have both pieces, you can use the CashFlows::npv() function (see
<http://quantlib.org/reference/class_quant_lib_1_1_cash_flows.html>.)


> 2. I understand Quantlib has the interpolation and curve fitting methods
> that allow us to create a curve given   key rates. I managed to generate a
> zero-curve based on this. However, I am wondering if Quantlib is able to
> return me zero rates on any points on the zero-curve(those not falling
> exactly on the key dates I used as input)? For example, I used T-rates on
> Jan1,2008, Feb1,2008, Mar 1, 2008.... to build the zero-curve, but I would
> want to get zero-rates on Feb25,2008, for example.

Yes.  The zero curve you obtained inherits from the YieldTermStructure
class, which defines a zeroRate method returning zero rates at any date
(see
<http://quantlib.org/reference/class_quant_lib_1_1_yield_term_structure.html>.)

Luigi


--

Do the right thing. It will gratify some people and astonish the rest.
-- Mark Twain



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users