Posted by
Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/spreadedTermStructure-tp5694p5695.html
On Mon, 2008-03-24 at 13:49 -0700, gigifaye29 wrote:
> 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?
They should be equivalent. How did you instantiate ts0_spreaded? And
what was the error?
> 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?
Yes, the added spread is a linear function of the adjacent spreads.
For details, You can look at the zeroYieldImpl() method in the
PiecewiseZeroSpreadedTermStructure class.
Luigi
--
Discontent is the first necessity of progress.
-- Thomas A. Edison
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users