yearFraction function

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

yearFraction function

Guowen Han

Hello, group

Could someone explain why the member function yearFraction(d1, d2)  in DayCounter crash the program when d1 and d2 are very close (for instance, 2 days difference in my program)?

Thanks very much.


Guowen
Reply | Threaded
Open this post in threaded view
|

Re: yearFraction function

Luigi Ballabio
On 10/04/2005 02:27:22 PM, Guowen Han wrote:
> Could someone explain why the member function yearFraction(d1, d2)  
> in DayCounter crash the program when d1 and d2 are very close (for
> instance, 2 days difference in my program)?

The issue is fixed in CVS (and therefore in next release.)
However, it is advisable to also pass the start and end of the  
reference period when using actual/actual ISMA.

Later,
        Luigi

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

The first rule of intelligent tinkering is to save all the parts.
-- Paul Erlich



Reply | Threaded
Open this post in threaded view
|

Credit default pricing / G2++ model

Toyin Akin
Hi folks,

Are there any plans to implement credit default swaps/options within
QuantLib?

I read somewhere, within one of the wilmott forums, that someone did
actually have some working code. However I'm not too sure whether they are
going to dedicate this code to the QuantLib project.

I certainly would like to get a good handle on a C++ implementation of
Credit derivatives as I'm pretty new to it, however I don't want to start a
new credit project which could take months if someone else already has some
working code.

Also, I am stepping through the code of the G2++ model, comparing the math
there to that of the Brigo-Mercurio book and all seems well apart from one
expression that I can't get my head around.

This concerns the code within the constructor of the
G2::SwaptionPricingFunction class.

There are expressions for mux_ and muy_ which I believe corresponds to the
same expressions at the bottom of page 144.

Taking just the mux_ expression, for example, I cannot match up the
expressions within the book to that of the code. It's the 2nd and 3rd
expressions of the formula (according to the book) that I am having some
trouble matching up.

Can someone confirm that the code here is correct and it's just a case of
some smart mathematical  manipulation (My brain has already died after
validating all the other parts of the G2 model!!).

Also from my analysis, it looks like we can only price options on vanilla
swaptions under this G2++ implementation, no variation of notionals
(amortisation), coupons, or margins (spreads). This should be possible but I
believe that the limiting factor is because it is based on a SimpleSwap
object which does not allow for such rich definitions of a swap.

Also, does anyone know what code changes would be needed to implement a
bermudan swaption on a FLT/FLT swap? I don't think that the
SwaptionPricingFunction class is valid for this type of structure.

Very good clean code by the way...

Best Regards,
Toyin Akin.