After I made the changes you suggested, I get the following results (payments year 1 to year 5) :
Repricing of quoted CDSs employed for calibration:
NPV: 4.15861e-06
default leg: 0.011703
coupon leg: -0.0116988
NPV: 9.52244e-06
default leg: 0.0226702
coupon leg: -0.0226607
NPV: 1.14725e-05
default leg: 0.0328088
coupon leg: -0.0327973
NPV: 1.48407e-05
default leg: 0.0422875
coupon leg: -0.0422726
NPV: 1.79806e-05
default leg: 0.0511236
coupon leg: -0.0511056
My Problem is that the NPV is still nearly zero…
These are the values, which I would expect:
Premium
Protection
0.93221224
0.01949860
0.86901967
0.01817684
0.81011059
0.01694467
0.75519505
0.01579603
0.70400209
0.01472525
Do you have any further ideas on how to calculate these values or is my problem maybe something else?
Regards,
Patrick
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Donnerstag, 10. April 2014 11:13
Ok, if you're given an hazard rate use that one instead of bootstrapping. You can use the FlatHazardRate class for that. Build an instance with the given hazard rate and use it in place of the PiecewiseDefaultCurve you're using.
Luigi
On Thu, Apr 10, 2014 at 8:49 AM, Heinze, Patrick <[hidden email]> wrote:
Hello,
The default probability within a year is 2% upon condition that no default has occurred before. The corresponding continuous hazard rate is 2,02% p.a.
Time (Years) default probability
1 0.0200
2 0.0196
3 0.0192
4 0.0188
5 0.0184
Changing the point for bootstrap to 5-years only results in getting my previous 5-year result for each year.
In numbers, the returned values are:
NPV: -3.20674e-13
Default leg: 0.0511065
Coupon leg: -0.0511065
My expected premium is 4.07053964 and my expected protection is 0.08514138.
Thanks again for your help.
Patrick
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Mittwoch, 9. April 2014 17:22
To: Heinze, PatrickSubject: Re: [Quantlib-users] Calibration of CDS.cpp
Hello,
you set the spread you're given as all the quoted spreads that you're using for building the curve, so that's going to be the fair spread of all cds by construction. What default probability curve does Hull use? Also, what if you only use the 5-years point for bootstrap? (That is, just one quoted spread and just one maturity = 5 years?) Are the values closer to what you expect?
Luigi
On Wed, Apr 2, 2014 at 1:22 PM, Heinze, Patrick <[hidden email]> wrote:
Hello Luigi,
thank you for your quick answer.
Please find a code extract attached.
Due to internal restrictions, I am not allowed to post the complete code.
However, the program logic should still be working.
Regards,
Patrick
-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Mittwoch, 2. April 2014 11:36
To: Heinze, Patrick
Cc: [hidden email]
Subject: Re: [Quantlib-users] Calibration of CDS.cpp
Hello Patrick,
may you post your modified code?
Later,
Luigi
On Tue, Apr 1, 2014 at 3:35 PM, Heinze, Patrick <[hidden email]> wrote:
> Hello everybody,
>
> currently, I am writing my Bachelor thesis and I try to use QuantLib to
> generate realistic Credit Default Swaps. I am new to quantitative finance.
> That's why I tried to rebuild an example which I found in "Options, Futures,
> and Other Derivatives" by J. Hull, using the CDS.cpp example from
> quantlib.org. Unfortunately, up to now, I wasn't able to do so and I
> wondered if you might help me.
>
> The following values were used by Hull:
>
> Notional: 1 $
> Spread: 0.012420
> Schedule: Annual
> Yield curve: 5% LIBOR
> Recovery rate: 40%
> Duration: 5 Years
>
>
> I changed the "flatRate" to 0.05 and created "tenors" for each year
> (1*Years, ..., 5*Years). Afterwards I changed the "schedule" from quarterly to
> annual and set the "DateGeneration" to Forward. Besides some further output,
> I did not make any other changes.
>
> The resulting survival probability and discount factor are nearly as in the
> example from Hull. Moreover, the hazard rate values are ok. Unfortunately,
> the NPV, the default leg and the coupon leg are not the same as in Hull's
> example. As far as I can see, that's because of a calibration, in order to
> get the NPV to zero. Is there a chance to prevent this calibration being
> computed, so that I can see the previous NPVs' using the spread which I
> provided instead of the fair spread?
>
> Thank you in advance.
>
> Best regards,
> Patrick
>
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>
--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>
| Free forum by Nabble | Edit this page |