spreadedTermStructure

Posted by gigifaye29 on
URL: http://quantlib.414.s1.nabble.com/spreadedTermStructure-tp5694.html

Hello,

First appreciate your help on my questions:

QUESTION I:
I tried to add a single spread( Say, C) to a Zero Curve derived from an observed yield curve. And I have set up codes to produce "ts0" of type "boost::shared_ptr<YieldTermStructure>"

(1)I wanted to calculate the PV of some cashflows, and it worked if I did:
ppv = CashFlows::npv(myFixedBond->cashflows()[i], singleInterestRate, today, today, 0);
where singleInterestRate = InterestRate( Rate(ts0->zeroRate(...) ) +C ,....)
and then sum all ppv up to get the the PV.

(2)But I also tried the other way by creating "ts0_spreaded" of type "boost::shared_ptr<ZeroSpreadedTermStructure>" with the spread C added to it and did the following for the same purpose to get PV:
PV = CashFlows::npv(myFixedBond->cashflows(), *(ts0_spreaded.get()), today, today, 0);

But then it didn't work....(no compiling error but a running time one)

Are the above 2 approaches equivalent? or they are quite different?

QUESTION II:

I understand that a PiecewiseZeroSpreadedTermStructure() allows me to add a VECTOR of spreads for corresponding key dates to the original termStructure. Does the name Piecewise mean the added spreads to a single key date would be a linear function of the adjacent two added spreads piping up together but not just a single spread is actually added?

Thanks again,
Xin

Thanks again,