Using QuantLib to value a Zero Coupon Swap

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

Using QuantLib to value a Zero Coupon Swap

Keith Weintraub

Folks,

  Could any of you point me to an example (or give me an example) of how to value a Zero Coupon Swap in QuantLib?

 

I’m resubmitting this question since it seems that the original thread has been somehow co-opted by an unrelated topic.

 

Thanx again,

KW

 

Reply | Threaded
Open this post in threaded view
|

Re: Using QuantLib to value a Zero Coupon Swap

Luigi Ballabio
On 03/24/2006 01:53:16 PM, Keith Weintraub wrote:
>   Could any of you point me to an example (or give me an example) of
> how to value a Zero Coupon Swap in QuantLib?

Apologies for the delay.

You can use the Swap class and pass it two cash-flow vectors reflecting  
the payments. For the zero leg, you can create a  
vector<shared_ptr<CashFlow> > and add a single SimpleCashFlow; the  
floating leg can be built be means of the functions in  
ql/CashFlows/cashflowvectors.hpp (possibly appending to the returned  
vector a SimpleCashFlow to balance the zero leg, if the cash flow in  
the latter included the exchange of the notional.)

Luigi


----------------------------------------

Zawinski's Law:
        Every program attempts to expand until it can read mail. Those
        programs which cannot so expand are replaced by ones which can.