Jamshidian engine with start delay

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

Jamshidian engine with start delay

Peter Caspers-4
Hello,

in the JamshidianSwaptionEngine the option expiry date and the value date of the underlying swap are handled a bit simplified assuming both dates equal (see the warning in the code). Though the impact is usually not very big we might want to improve this detail in the library ? See below for a possible approach. Thank you Sebastian for our discussions on the topic.

Aside I would be interested whether the Jamshidian method is still in use for model calibration in the world of multi curve enhanced models (where by enhanced I mean something simple like a static spread correction) because I believe the generalization of the method to this setting is not straightforward. Also I feel that numerical integration does nearly a just as efficient and accurate job and it directly allows for multiple curve computations. Or do you ignore multi curve in the calibration phase and only adjust the curves for the actual pricing ?

Back to Jamshidian and the start delay. Some theoretical background and numerical examples can be found here

http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2246054

A possible implementation goes as follows. First we need to provide an extended zerobond option method, which we can add to AffineModel in model.hpp

https://github.com/pcaspers/quantlib/commit/e16b4ea5ffbfe33bd6acd0ee6cb3ecd8a43f72a4

The default implementation uses the same simplification as mentioned above ignoring the bond start delay. To improve the pricing in the JamshidianEngine we have to overwrite this method in the model implementations for which we want it. For the Hull White model I did it here

https://github.com/pcaspers/quantlib/commit/e8b5912cac2e236fe59a885e8cd1e2ed9243cc47


Finally we have to modify the Jamshidian engine a bit

https://github.com/pcaspers/quantlib/commit/019f37a498846d9a6e89a897300f126c01d6ef86

(maybe we should keep some warning in the code because you are not forced to support the start delay in your model implementations)

Not suprisingly the test suite breaks when comparing computation results to cached values computed with the simplified engine, so the cached values should be updated (given that we believe in the new engine)

1>  Testing Hull-White calibration against cached values...
1>  shortratemodels.cpp(126): error in "QuantLib::detail::quantlib_test_case(&ShortRateModelTest::testCachedHullWhite)": Failed to reproduce cached calibration results:
1>  calculated: a = 0.0464041, sigma = 0.00579912, f(a) = 0.1158,
1>  expected:   a = 0.0488565, sigma = 0.00593662, f(a) = 0.121599,
1>  difference: a = -0.00245242, sigma = -0.000137495, f(a) = -0.00579896,
1>  end criteria = StationaryFunctionValue

regards
  Peter


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Jamshidian engine with start delay

Ferdinando M. Ametrano-3
I'm ok with your extension provided that the new values collapse back to the old ones (with a reasonable tolerance) in the case of expiry date being equal the value date.
Is the data you've posted related to this case?

It's a while now I do not work for a vol desk, but I would never underestimate the huge difference of analytic vs numerical methods when it comes to calibration.

This said I would also add that I'm always amazed how poor the production setup is, even in very sophisticated banks. Old models stick around for very long time, just because of the huge effort required to update them in production systems. The multi-curve framework updates I've seen so far rival with Mary Shelley's Frankenstein approach


On Sat, May 11, 2013 at 1:37 PM, Peter Caspers <[hidden email]> wrote:
Hello,

in the JamshidianSwaptionEngine the option expiry date and the value date of the underlying swap are handled a bit simplified assuming both dates equal (see the warning in the code). Though the impact is usually not very big we might want to improve this detail in the library ? See below for a possible approach. Thank you Sebastian for our discussions on the topic.

Aside I would be interested whether the Jamshidian method is still in use for model calibration in the world of multi curve enhanced models (where by enhanced I mean something simple like a static spread correction) because I believe the generalization of the method to this setting is not straightforward. Also I feel that numerical integration does nearly a just as efficient and accurate job and it directly allows for multiple curve computations. Or do you ignore multi curve in the calibration phase and only adjust the curves for the actual pricing ?

Back to Jamshidian and the start delay. Some theoretical background and numerical examples can be found here

http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2246054

A possible implementation goes as follows. First we need to provide an extended zerobond option method, which we can add to AffineModel in model.hpp

https://github.com/pcaspers/quantlib/commit/e16b4ea5ffbfe33bd6acd0ee6cb3ecd8a43f72a4

The default implementation uses the same simplification as mentioned above ignoring the bond start delay. To improve the pricing in the JamshidianEngine we have to overwrite this method in the model implementations for which we want it. For the Hull White model I did it here

https://github.com/pcaspers/quantlib/commit/e8b5912cac2e236fe59a885e8cd1e2ed9243cc47


Finally we have to modify the Jamshidian engine a bit

https://github.com/pcaspers/quantlib/commit/019f37a498846d9a6e89a897300f126c01d6ef86

(maybe we should keep some warning in the code because you are not forced to support the start delay in your model implementations)

Not suprisingly the test suite breaks when comparing computation results to cached values computed with the simplified engine, so the cached values should be updated (given that we believe in the new engine)

1>  Testing Hull-White calibration against cached values...
1>  shortratemodels.cpp(126): error in "QuantLib::detail::quantlib_test_case(&ShortRateModelTest::testCachedHullWhite)": Failed to reproduce cached calibration results:
1>  calculated: a = 0.0464041, sigma = 0.00579912, f(a) = 0.1158,
1>  expected:   a = 0.0488565, sigma = 0.00593662, f(a) = 0.121599,
1>  difference: a = -0.00245242, sigma = -0.000137495, f(a) = -0.00579896,
1>  end criteria = StationaryFunctionValue

regards
  Peter


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev



------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Jamshidian engine with start delay

Peter Caspers-4
For zero days between option and start date the results are identical up to
1E-14, for example the old engine resp. new engine gives

0.06257488979659526
0.06257488979659394

for a 5y into 5y atm swaption vs. Euribor 6m, 3% forward flat yts, 1% volatility and
reversion, asof 30-04-2013.

The differences in the test suite displayed below are much bigger because there
a start delay of 2 business days applies. We could maybe produce cached
values with the old engine for a test case with expiry = start date
before moving to the new engine.

Thanks for your comments.

regards
 Peter


Ferdinando Ametrano <[hidden email]> writes:

> I'm ok with your extension provided that the new values collapse back to the
> old ones (with a reasonable tolerance) in the case of expiry date being equal
> the value date.
> Is the data you've posted related to this case?
>
> It's a while now I do not work for a vol desk, but I would never underestimate
> the huge difference of analytic vs numerical methods when it comes to
> calibration.
>
> This said I would also add that I'm always amazed how poor the production setup
> is, even in very sophisticated banks. Old models stick around for very long
> time, just because of the huge effort required to update them in production
> systems. The multi-curve framework updates I've seen so far rival with Mary
> Shelley's Frankenstein approach
>
>
> On Sat, May 11, 2013 at 1:37 PM, Peter Caspers <[hidden email]> wrote:
>
>     Hello,
>
>     in the JamshidianSwaptionEngine the option expiry date and the value date
>     of the underlying swap are handled a bit simplified assuming both dates
>     equal (see the warning in the code). Though the impact is usually not very
>     big we might want to improve this detail in the library ? See below for a
>     possible approach. Thank you Sebastian for our discussions on the topic.
>
>     Aside I would be interested whether the Jamshidian method is still in use
>     for model calibration in the world of multi curve enhanced models (where by
>     enhanced I mean something simple like a static spread correction) because I
>     believe the generalization of the method to this setting is not
>     straightforward. Also I feel that numerical integration does nearly a just
>     as efficient and accurate job and it directly allows for multiple curve
>     computations. Or do you ignore multi curve in the calibration phase and
>     only adjust the curves for the actual pricing ?
>
>     Back to Jamshidian and the start delay. Some theoretical background and
>     numerical examples can be found here
>
>     http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2246054
>
>     A possible implementation goes as follows. First we need to provide an
>     extended zerobond option method, which we can add to AffineModel in
>     model.hpp
>
>     https://github.com/pcaspers/quantlib/commit/
>     e16b4ea5ffbfe33bd6acd0ee6cb3ecd8a43f72a4
>
>     The default implementation uses the same simplification as mentioned above
>     ignoring the bond start delay. To improve the pricing in the
>     JamshidianEngine we have to overwrite this method in the model
>     implementations for which we want it. For the Hull White model I did it
>     here
>
>     https://github.com/pcaspers/quantlib/commit/
>     e8b5912cac2e236fe59a885e8cd1e2ed9243cc47
>
>     Finally we have to modify the Jamshidian engine a bit
>
>     https://github.com/pcaspers/quantlib/commit/
>     019f37a498846d9a6e89a897300f126c01d6ef86
>
>     (maybe we should keep some warning in the code because you are not forced
>     to support the start delay in your model implementations)
>
>     Not suprisingly the test suite breaks when comparing computation results to
>     cached values computed with the simplified engine, so the cached values
>     should be updated (given that we believe in the new engine)
>
>     1>  Testing Hull-White calibration against cached values...
>     1>  shortratemodels.cpp(126): error in
>     "QuantLib::detail::quantlib_test_case(&
>     ShortRateModelTest::testCachedHullWhite)": Failed to reproduce cached
>     calibration results:
>     1>  calculated: a = 0.0464041, sigma = 0.00579912, f(a) = 0.1158,
>     1>  expected:   a = 0.0488565, sigma = 0.00593662, f(a) = 0.121599,
>     1>  difference: a = -0.00245242, sigma = -0.000137495, f(a) = -0.00579896,
>     1>  end criteria = StationaryFunctionValue
>
>     regards
>       Peter
>
>    
>     ------------------------------------------------------------------------------
>     Learn Graph Databases - Download FREE O'Reilly Book
>     "Graph Databases" is the definitive new guide to graph databases and
>     their applications. This 200-page book is written by three acclaimed
>     leaders in the field. The early access version is available now.
>     Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>     _______________________________________________
>     QuantLib-dev mailing list
>     [hidden email]
>     https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Jamshidian engine with start delay

nriyait
In reply to this post by Ferdinando M. Ametrano-3

Is there a way I can incorporate accrued interest and yield calculations for incorporate Mortgaged Backed Securities in QuantLib ?

 

From: Ferdinando Ametrano [mailto:[hidden email]]
Sent: 15 May 2013 09:19
To: Peter Caspers
Cc: [hidden email]
Subject: Re: [Quantlib-dev] Jamshidian engine with start delay

 

I'm ok with your extension provided that the new values collapse back to the old ones (with a reasonable tolerance) in the case of expiry date being equal the value date.

Is the data you've posted related to this case?

 

It's a while now I do not work for a vol desk, but I would never underestimate the huge difference of analytic vs numerical methods when it comes to calibration.

 

This said I would also add that I'm always amazed how poor the production setup is, even in very sophisticated banks. Old models stick around for very long time, just because of the huge effort required to update them in production systems. The multi-curve framework updates I've seen so far rival with Mary Shelley's Frankenstein approach

 

 

On Sat, May 11, 2013 at 1:37 PM, Peter Caspers <[hidden email]> wrote:

Hello,

in the JamshidianSwaptionEngine the option expiry date and the value date of the underlying swap are handled a bit simplified assuming both dates equal (see the warning in the code). Though the impact is usually not very big we might want to improve this detail in the library ? See below for a possible approach. Thank you Sebastian for our discussions on the topic.

Aside I would be interested whether the Jamshidian method is still in use for model calibration in the world of multi curve enhanced models (where by enhanced I mean something simple like a static spread correction) because I believe the generalization of the method to this setting is not straightforward. Also I feel that numerical integration does nearly a just as efficient and accurate job and it directly allows for multiple curve computations. Or do you ignore multi curve in the calibration phase and only adjust the curves for the actual pricing ?

Back to Jamshidian and the start delay. Some theoretical background and numerical examples can be found here

http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2246054

A possible implementation goes as follows. First we need to provide an extended zerobond option method, which we can add to AffineModel in model.hpp

https://github.com/pcaspers/quantlib/commit/e16b4ea5ffbfe33bd6acd0ee6cb3ecd8a43f72a4

The default implementation uses the same simplification as mentioned above ignoring the bond start delay. To improve the pricing in the JamshidianEngine we have to overwrite this method in the model implementations for which we want it. For the Hull White model I did it here

https://github.com/pcaspers/quantlib/commit/e8b5912cac2e236fe59a885e8cd1e2ed9243cc47


Finally we have to modify the Jamshidian engine a bit

https://github.com/pcaspers/quantlib/commit/019f37a498846d9a6e89a897300f126c01d6ef86

(maybe we should keep some warning in the code because you are not forced to support the start delay in your model implementations)

Not suprisingly the test suite breaks when comparing computation results to cached values computed with the simplified engine, so the cached values should be updated (given that we believe in the new engine)

1>  Testing Hull-White calibration against cached values...
1>  shortratemodels.cpp(126): error in "QuantLib::detail::quantlib_test_case(&ShortRateModelTest::testCachedHullWhite)": Failed to reproduce cached calibration results:
1>  calculated: a = 0.0464041, sigma = 0.00579912, f(a) = 0.1158,
1>  expected:   a = 0.0488565, sigma = 0.00593662, f(a) = 0.121599,
1>  difference: a = -0.00245242, sigma = -0.000137495, f(a) = -0.00579896,
1>  end criteria = StationaryFunctionValue

regards
  Peter


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

 



This message is intended only for the stated addressee(s) and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of Fidessa. Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Fidessa plc registered in England and Wales no. 3781700. VAT registration no. GB688900878. Registered office - Dukes Court, Duke Street, Woking, Surrey, GU21 5BH, UK
Fidessa buy-side ltd registered in England and Wales no. 3656437. VAT registration no. GB688900878. Registered office - Dukes Court, Duke Street, Woking, Surrey, GU21 5BH, UK
Fidessa group plc registered in England and Wales no. 3234176. VAT registration no. GB688900878. Registered office - Dukes Court, Duke Street, Woking, Surrey, GU21 5BH, UK


------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Jamshidian engine with start delay

Ferdinando M. Ametrano-3
In reply to this post by Peter Caspers-4
On Wed, May 15, 2013 at 9:03 PM, Peter Caspers <[hidden email]> wrote:
We could maybe produce cached
values with the old engine for a test case with expiry = start date
before moving to the new engine.

agreed, as far as I am concerned

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Jamshidian engine with start delay

Peter Caspers-4
ok, I have extended the test suite here

https://github.com/pcaspers/quantlib/commit/4e5a10ef9c45e940965316a3c7c4d698b3906e1b

(the commits regarding the changes in the library were

https://github.com/pcaspers/quantlib/commit/e8b5912cac2e236fe59a885e8cd1e2ed9243cc47
https://github.com/pcaspers/quantlib/commit/019f37a498846d9a6e89a897300f126c01d6ef86
https://github.com/pcaspers/quantlib/commit/e16b4ea5ffbfe33bd6acd0ee6cb3ecd8a43f72a4

and the doc was here

http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2246054

)

please just tell me if I can do anything else.

regards
 Peter

Ferdinando Ametrano <[hidden email]> writes:

> On Wed, May 15, 2013 at 9:03 PM, Peter Caspers <[hidden email]> wrote:
>
>     We could maybe produce cached
>     values with the old engine for a test case with expiry = start date
>     before moving to the new engine.
>
>
> agreed, as far as I am concerned

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev