Questions Re The CDO Class

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions Re The CDO Class

Alex Zhang-9
Hey Everybody,

I just started using Quantlib to build a CDO model asap. Since the CDO class is listed as experimental, I wonder if anyone can kindly share any experience using it and how close it can get to the Bloomberg's 1 factor CDO model (standard Gaussian). I wrote a little program to feed the CDO class with 100 identical DefaultProbabilityTermStructures. Then I priced CDO for 0%-100%, the fairPremium I got is close but different from the CDS premium that I was expecting. 

The reference (http://quantlib.org/reference/class_quant_lib_1_1_c_d_o.html) says it is designed to price mezzanine. I wonder if that matters.

Thanks a lot!

- Alex

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Questions Re The CDO Class

japari
Hi Alex,
----- "Alex Zhang" <[hidden email]> a écrit :

> Hey Everybody,
>
>
> I just started using Quantlib to build a CDO model asap. Since the CDO
> class is listed as experimental, I wonder if anyone can kindly share
> any experience using it and how close it can get to the Bloomberg's 1
> factor CDO model (standard Gaussian).

Theres no Base Correlation pricing engine yet and you are bound to get differences
since thats what Bloomberg will be doing. I started coding this but havent found the
time to finish it yet.

I wrote a little program to feed
> the CDO class with 100 identical DefaultProbabilityTermStructures.
> Then I priced CDO for 0%-100%, the fairPremium I got is close but
> different from the CDS premium that I was expecting.
>
The LHP should do the trick. Are you using zero RR on the CDS?, I mean a tranche like
that doesnt knock out like a CDS so they are not the same contract unless you twist
it a bit.

> The reference (
> http://quantlib.org/reference/class_quant_lib_1_1_c_d_o.html ) says it
> is designed to price mezzanine. I wonder if that matters.
>
I believe it means mezzanine as in 'any generic tranche'
Please post how it goes, I get the impression this hasnt been much tested.

Best
Pepe

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Questions Re The CDO Class

Alex Zhang-9
Salut, Pepe!

Thank you very much for your reply.

I spent a bit more time on it in the last 2 days. I am getting pretty close to Bloomberg pricing tranches like 0-15%, 3% -7% etc. I was aware that BBG uses base correlation. But I just made the attachment and detachment correlations the same. Guess that would be pretty much the same with compound correlation.

I was not using 0 RR. But IMHO, 0-100% spread should be the same with index spread. Could you please say more about LHP and why there could be difference between 0-100% spread and index spread?

One reason for my results to be different with BBG is the discount curve. I am using some dummy flat curve set at 5 YR USD Swap. But I don't know if that's enough to justify the difference. Let me double check my codes again and put my results here.

I will post more re my investigation if I find anything. Meanwhile, I need you and other people's direction desperately. Thanks!

- Alex


From: "[hidden email]" <[hidden email]>
To: Alex Zhang <[hidden email]>
Cc: [hidden email]
Sent: Wed, January 12, 2011 5:14:49 AM
Subject: Re: [Quantlib-users] Questions Re The CDO Class

Hi Alex,
----- "Alex Zhang" <[hidden email]> a écrit :

> Hey Everybody,
>
>
> I just started using Quantlib to build a CDO model asap. Since the CDO
> class is listed as experimental, I wonder if anyone can kindly share
> any experience using it and how close it can get to the Bloomberg's 1
> factor CDO model (standard Gaussian).

Theres no Base Correlation pricing engine yet and you are bound to get differences
since thats what Bloomberg will be doing. I started coding this but havent found the
time to finish it yet.

I wrote a little program to feed
> the CDO class with 100 identical DefaultProbabilityTermStructures.
> Then I priced CDO for 0%-100%, the fairPremium I got is close but
> different from the CDS premium that I was expecting.
>
The LHP should do the trick. Are you using zero RR on the CDS?, I mean a tranche like
that doesnt knock out like a CDS so they are not the same contract unless you twist
it a bit.

> The reference (
> http://quantlib.org/reference/class_quant_lib_1_1_c_d_o.html ) says it
> is designed to price mezzanine. I wonder if that matters.
>
I believe it means mezzanine as in 'any generic tranche'
Please post how it goes, I get the impression this hasnt been much tested.

Best
Pepe

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Questions Re The CDO Class

japari
In reply to this post by Alex Zhang-9
Hi again,

> But I just made the attachment
> and detachment correlations the same. Guess that would be pretty much
> the same with compound correlation.

True, that should work.
>
> I was not using 0 RR. But IMHO, 0-100% spread should be the same with
> index spread. Could you please say more about LHP and why there could
> be difference between 0-100% spread and index spread?
>
The difference is that under a name's default the notional in a CDS is zero, the
instrument knocks out independently of the realized recovery rate; in a credit
index swap the contract goes on after a default with a notional reduced by the
weight of the name in the basket independently of the realized recovery. In
a (QL) tranche the notional is reduced by the amount actually lost (recovery
dependent then) falling within tranche limits. So in a [0-100] tranche, under
a model with a fixed deterministic RR, you can not lose all the notional and
even in the case of all your names defaulting you still have some notional left
and will be receiving coupon till maturity. The equivalent contract would be a
CDS which doesnt knock out after default but pays a coupon on a notional
reduced by a LGD factor.
The default legs NPVs should match though. Is that the case?

For LHP see the class GaussianLHPCDOEngine in:
ql/experimental/credit/syntheticcdoengines.Xpp
But to compare to BBG use an heterogeneous algorithm, InhomogeneousPoolCDOEngine
would be my pick. Also notice you have lots of nuts and bolts to play around with;
to name a few, the copula integration limits and points, the number of buckets or
quadrature points in other engines, the period in the integration algorithms...some
of these get critical for high correlation values.

> One reason for my results to be different with BBG is the discount
> curve. I am using some dummy flat curve set at 5 YR USD Swap. But I
> don't know if that's enough to justify the difference. Let me double
> check my codes again and put my results here.
>
See what happens and if it does not match, can you report the differences and the
input data pls? And maybe the code too.

Best regards
Pepe

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Questions Re The CDO Class

japari
In reply to this post by Alex Zhang-9
Alex,
I wrote a few lines to show what I meant.
And then I noticed that there is indeed a problem with one of the engines, precisely the GLHPMidPointCDOEngine. This is the output of pricing a CDO of 100 names with a high prob of default. Shows what we talk; notice that engine is able to lose all the structure; and it is giving the same CL as a CDS.

----GLHPMidPointCDOEngine----
Remaining notional: 1
DL npv: -1
CL npv: -0.510428
Net NPV: 0.489572
Fair spread: 1.95914
----IHPMidPointCDOEngine----
Remaining notional: 1
DL npv: -0.62
CL npv: -4.25887
Net NPV: -3.63887
Fair spread: 0.145579
----HPMidPointCDOEngine----
Remaining notional: 1
DL npv: -0.6
CL npv: -4.3445
Net NPV: -3.7445
Fair spread: 0.138106
----GaussRecCDOEngine----
Remaining notional: 1
DL npv: -0.599993
CL npv: -4.36521
Net NPV: -3.76522
Fair spread: 0.137449

Expected losses at coupon times:
----GLHPMidPointCDOEngine----
0 , 0.400171 , 0.640205 , 0.782983 , 0.869102 , 0.921483
----IHPMidPointCDOEngine----
0 , 0.250303 , 0.394738 , 0.479654 , 0.53103 , 0.562279
----HPMidPointCDOEngine----
0 , 0.249103 , 0.393123 , 0.478792 , 0.53054 , 0.56207
----GaussRecCDOEngine----
0 , 0.240099 , 0.384119 , 0.469785 , 0.521456 , 0.552885

CDS DL0.6
CDS CL-0.510428
CDS Fair: 1.17548
Run completed in 1 m 40 s


I think is the way the losses are divided by the LGD in the code. I'll send a patch sometime next week.

Best regards
Pepe

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

cdotests.cpp (7K) Download Attachment