[ quantlib-Patches-2925351 ] CDX

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ quantlib-Patches-2925351 ] CDX

SourceForge.net
Patches item #2925351, was opened at 2010-01-03 21:51
Message generated for change (Comment added) made by japaricio
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=312740&aid=2925351&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Aparicio-Navarro Jose (japaricio)
Assigned to: Nobody/Anonymous (nobody)
Summary: CDX

Initial Comment:
Trash for the iTraxx,
I am sending an example in the CDX.cpp file. It covers the flat engine and the options. To test the intrinsic engine, compute basis etc I use a worksheet add-in because the amount of data is quite large; spread curves, default status, settlement data etc...

The option engine now owns the underlying swap. I have done this for two reasons, one is to make sure that the prob curve used to price the swap and the option are the same. Also because an outside swap was forcing me to make copies of the swap in the engines calculate to be exception safe (I could break an outside set up engine). Might be nice to change the CDS option in a similar way (but there for the first reason only).

I went for a very flexible index. For instance; the intrinsic spread can be computed at a forward date. This can be of some use (e.g. options) but keeps the code from using Lazyness to cache the intrinsic and average spreads. The index could have done without owning a schedule if they could only be constructed with the standard conventions and rule. This is comented in the code.

I have not updated the makefiles with the new files.
The code in the issuer and defaultType patches supersedes the fix I sent for Bug 2883169.

Best regards and a very happy 2010 to all of you.
Pepe

----------------------------------------------------------------------

>Comment By: Aparicio-Navarro Jose (japaricio)
Date: 2010-01-07 19:20

Message:
After suggestions from Toyin Akin who took the trouble of analysing the
code I
have been taken out of my lazyness and code a proper TS bootstrap. The
result
is now within 14 bp of error from the markit calculator result.
The initial TS bootstrap was giving 71 bp difference. This code is 44 bp
away.
You get 14 bp error by using a non flat hazard rate bootstrap (see MarkIt

calculator, I can send you a screenshot) and 0 days delay in the TS
instruments.
I havent done this because the index quote has to be understood flat to
its tenor,
the quotes do not represent a term structure, they are a price, not a fair
spread
you can enter into a contract.

Markit NPV..............30454.88
previous result.........30239.45.......-0.71%
res new bootstrap.......30587.93........0.44%
non flat and 0 days curve
instrument settlement...30498.15........0.14%

Toyin also pointed me out about an unused local in the intrinsic index
engine
'calculate' which I am removing now.

If you want to quickly try the non flat HR this is the curve (got it using
the
CDS bootstrap):

vector<Natural> datesSN ;
datesSN +=
40074, 40257, 40349, 40441, 40532, 40897, 41263, 41628, 41993, 42724,
43819;

vector<Date> datesHRs;

for(Size i=0; i<datesSN.size(); i++)
    datesHRs.push_back(Date(datesSN[i]));

vector<Real> hRsData;
hRsData +=
0.033278662, 0.033278662, 0.033278662, 0.033272456, 0.033252841,
0.033224688,
0.033194453, 0.033182468, 0.033160034, 0.033156331, 0.033147345;

const Handle<DefaultProbabilityTermStructure> flatHRdefaultProb(
    boost::shared_ptr<InterpolatedHazardRateCurve<BackwardFlat> >(new
    InterpolatedHazardRateCurve<BackwardFlat>(datesHRs, hRsData, dayCtr,
calendar)
                ));

ok, the HR TS variable name is not adequate now....

Also, if anyone wants to test the probability curve shown in the Markit
calculator use:

flatHRdefaultProb->enableExtrapolation();
for(Size i=0; i<datesSN.size(); i++)
    cout<< datesHRs[i].serialNumber() << " , " <<
       flatHRdefaultProb->defaultProbability(datesHRs[i]) << endl;
cout<< Date(today + Period(15, Years)).serialNumber() << " , " <<
        flatHRdefaultProb->defaultProbability(Date(today +
        Period(15, Years))) << endl;
cout<< Date(today + Period(20, Years)).serialNumber() << " , " <<
        flatHRdefaultProb->defaultProbability(Date(today +
        Period(20, Years))) << endl;
cout<< Date(today + Period(30, Years)).serialNumber() << " , " <<
        flatHRdefaultProb->defaultProbability(Date(today +
        Period(30, Years))) << endl;



I havent played the reverse engineering game to the full; interpolators,
CDS
bootstrap parameters, schedules, index inception date (its a Saturday),
etc..

Also I am updating the basket patch file, I missed a disposability
opportunity.

Best regards
Pepe

----------------------------------------------------------------------

Comment By: Aparicio-Navarro Jose (japaricio)
Date: 2010-01-04 12:27

Message:
Hi again,
I have been moving to a newer branch of the lib to find out the
FixedRateLeg helper I was using in the index swap was obsolete and the
files I sent were missing a patch for an extra function in imm.xpp

Best regards
Pepe

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=312740&aid=2925351&group_id=12740

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev