Posted by
cheng li on
Jan 08, 2013; 2:10pm
URL: http://quantlib.414.s1.nabble.com/FW-Building-Yield-Curve-of-Zero-Rates-tp13877p13878.html
Hi Theophilus,
Have you constructed the curve correctly? As described in your mail, the
market data is zero yield. However you built the curve as forward curve:
Handle<YieldTermStructure> yieldCurve(
boost::shared_ptr<YieldTermStructure>(
new ForwardCurve(yieldMaturities,yields,
dayCountConv)));
That means quantlib took the yields as forward instantaneous rates instead
of zero rates. I think this is where the difference comes from.
Regards
Cheng
-----邮件原件-----
发件人: Boafo, Theophilus [mailto:
[hidden email]]
发送时间: 2013年1月8日 8:35
收件人:
[hidden email]
抄送: Luigi Ballabio
主题: [Quantlib-users] FW: Building Yield Curve of Zero Rates
Hi All,
I have Sample of USD Zero Yield Curve Data as follows:
Observation Date
03/08/2012
Maturity Days
0,3,4,11,35,67,96,137,227,320,411,501,591,734,1099,1466,1830,2195,2560,2
926,3293,3657,4387,5484,7311,9135,10961,
Yield
0,1.57151762841849E-03,1.5841928756397E-03,1.80193133074194E-03,2.374223
75119134E-03,3.30406684491067E-03,4.35679286119092E-03,3.56334288917869E
-03,3.69745160830227E-03,3.77125648757358E-03,3.84515157443031E-03,3.928
32387415253E-03,4.03993077763243E-03,4.35625780531457E-03,5.080685648854
12E-03,6.4706614338575E-03,8.38591062422842E-03,0.010332793648027,1.2171
0204339663E-02,1.38041853050158E-02,1.52910208160213E-02,1.6727919706485
3E-02,1.89718781527944E-02,2.12626395949329E-02,2.31753447176866E-02,2.4
1372894297357E-02,2.47383920090547E-02
InterpolationType
Linear
Extrapolation Type
near
DayCount Convention
ACT365FIXED
Compunding Frequency
CONTINUOUS,
So I build a vector<QuantLib::Date> yieldMaturities, vector<Rate> yields
from the information above.
In the case of vector<QuantLib::Date> yieldMaturities, I just add the
Maturity Days to observation date.
I now build the yieldCurve as
Handle<YieldTermStructure> yieldCurve(
boost::shared_ptr<YieldTermStructure>(
new ForwardCurve(yieldMaturities,yields,
dayCountConv)));
Then pass to
boost::shared_ptr<BlackProcess> blackProcess(
new BlackProcess(underlyingH, yieldCurve,
flatVolTS));
as I am cant determine what the zero rate will be for the exercise date of
the option.
Now given this option is on a commodity forward, I want to discount from
payment date.
Hence have
DiscountFactor expiryDiscount =
blackProcess->riskFreeRate()->discount(europeanExercise->lastDate());
DiscountFactor paymentDiscount =
blackProcess->riskFreeRate()->discount(paymentDate);
Real forwardValue = europeanOption.NPV()/expiryDiscount;
Real presentValue = forwardValue * paymentDiscount;
My PV is slightly off the PV from another system.
The market data is the same in both systems, except for the difference in
discount factors.
The paymentDiscount factor in Quantlib is 0.9990450902703203, whilst that
from the other system is 0.9987391782033116, hence diff in PV.
I am wondering whether my yieldCurve of Zeros has been constructed properly.
Also its seems YieldTermStructure takes in market quotes and boostraps zero
rates from it. So Given I already have Zero rates, have I contstructed the
Zero Yield Curve propely? Looks like I have not done something right.
Regards
Theo
Regards
Theo
"This e-mail and any attachments to it (the "Communication") is, unless
otherwise stated, confidential, may contain copyright material and is for
the use only of the intended recipient. If you receive the Communication in
error, please notify the sender immediately by return e-mail, delete the
Communication and the return e-mail, and do not read, copy, retransmit or
otherwise deal with it. Any views expressed in the Communication are those
of the individual sender only, unless expressly stated to be those of
Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any
of its related entities including ANZ Bank New Zealand Limited (together
"ANZ"). ANZ does not accept liability in connection with the integrity of or
errors in the Communication, computer virus, data corruption, interference
or delay arising from or in respect of the Communication."
----------------------------------------------------------------------------
--
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and
more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users