Login  Register

Re: Using QuantLib to value a Zero Coupon Swap

Posted by Luigi Ballabio on Apr 04, 2006; 4:56am
URL: http://quantlib.414.s1.nabble.com/Using-QuantLib-to-value-a-Zero-Coupon-Swap-tp4652p4653.html

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.