Posted by
Luca Berardi on
Feb 24, 2005; 6:42am
URL: http://quantlib.414.s1.nabble.com/Possible-problem-on-bermuda-swaptions-2-tp3621p3635.html
Still on the exercise dates issue:
Assume for simplicity that the floating and fixed leg of the
underlying swap have the same schedule. In pricing the bermuda
swaption one should discard the very successive payment after the
current exercise date.
If the floating and fixed leg have different schedules (e.g. funding
leg pays quarterly and fixed annually) things get more complicated
because all the swap cashflows following the current exercise dates
must be discarded until we reach the second cashflow of the lower
frequency leg.
I realize that getting things working correctly (should my
interpretation be indeed correct) is not an easy task in the current
framework. This is because the DiscretizedSwaption does not know of
the underlying swap's cashflows. A possible workaround would be to
rewrite the pricing engine as to rollback the swaption and the swap
together...maybe? Could I be of any help?
>-- Messaggio Originale --
>From: Luigi Ballabio <
[hidden email]>
>To: Luca Berardi <
[hidden email]>
>Cc:
[hidden email]
>Subject: [Quantlib-users] Bermudan swaption patch (was Re: Possible problem
>on bermuda
> swaptions)
>Date: Thu, 24 Feb 2005 11:17:54 +0000
>
>
>
>On 02/24/05 11:52:05, Luca Berardi wrote:
>>
>> >Instead, the problem in the new release seems to be some date
>> >synchronization: namely, due to date adjustment it may happens that an
>> >exercise date is one or two days earlier than a fixed-coupon payment.
>>
>> This is an extremely interesting issue, and I had the chance to
>> discuss it thoroughly with a trader recently. He explained to me that
>> the very successive cashflow of the underlying swap after the exercise
>> date should NEVER be considered in the bermuda swaption pricing.
>
>Yes, that is the correct behavior. The following patch (tested on the
>BermudanSwaption example, which did give different results in 0.3.7 and
>
>0.3.8---somehow this escaped testing) should fix this; you can try and
>apply it to the QuantLib 0.3.8 sources to see if you get the correct
>figures.
>
>Later,
> Luigi
>
>diff -r -C 3 QuantLib-0.3.8/ql/Instruments/swaption.cpp QuantLib-0.3.8-
>patched/ql/Instruments/swaption.cpp
>*** QuantLib-0.3.8/ql/Instruments/swaption.cpp Mon Oct 25 16:00:28 2004
>--- QuantLib-0.3.8-patched/ql/Instruments/swaption.cpp Thu Feb 24 10:53:17
>
>2005
>***************
>*** 85,90 ****
>--- 85,120 ----
> "fair swap rate null or not set");
> QL_REQUIRE(fixedBPS != Null<Real>(),
> "fixed swap BPS null or not set");
>+ }
>+
>+ namespace {
>+
>+ inline bool withinPreviousWeek(Time t1, Time t2) {
>+ static const Time dt = 1.0/52;
>+ return t1-dt <= t2 && t2 <= t1;
>+ }
>+
>+ inline bool withinNextWeek(Time t1, Time t2) {
>+ static const Time dt = 1.0/52;
>+ return t1 <= t2 && t2 <= t1+dt;
>+ }
>+
>+ }
>+
>+ void Swaption::arguments::adjust() {
>+ // Date adjustments can get time vectors out of synch.
>+ // Here, we try and collapse similar dates.
>+ for (Size i=0; i<stoppingTimes.size(); i++) {
>+ Time exercise = stoppingTimes[i];
>+ for (Size j=0; j<fixedPayTimes.size(); j++){
>+ if (withinNextWeek(exercise, fixedPayTimes[j]))
>+ fixedPayTimes[j] = exercise;
>+ }
>+ for (Size k=0; k<floatingResetTimes.size(); k++) {
>+ if (withinPreviousWeek(exercise,floatingResetTimes[k]))
>+ floatingResetTimes[k] = exercise;
>+ }
>+ }
> }
>
> }
>diff -r -C 3 QuantLib-0.3.8/ql/Instruments/swaption.hpp QuantLib-0.3.8-
>patched/ql/Instruments/swaption.hpp
>*** QuantLib-0.3.8/ql/Instruments/swaption.hpp Fri Sep 17 12:05:42 2004
>--- QuantLib-0.3.8-patched/ql/Instruments/swaption.hpp Thu Feb 24 10:36:14
>
>2005
>***************
>*** 77,82 ****
>--- 77,83 ----
> // Exercise::Type exerciseType;
> // std::vector<Time> exerciseTimes;
> void validate() const;
>+ void adjust();
> };
>
> //! %Results from swaption calculation
>diff -r -C 3 QuantLib-0.3.8/ql/argsandresults.hpp QuantLib-0.3.8-patched/
>
>ql/argsandresults.hpp
>*** QuantLib-0.3.8/ql/argsandresults.hpp Wed Apr 21 17:00:26 2004
>--- QuantLib-0.3.8-patched/ql/argsandresults.hpp Thu Feb 24 10:30:49
>2005
>***************
>*** 36,41 ****
>--- 36,42 ----
> public:
> virtual ~Arguments() {}
> virtual void validate() const = 0;
>+ virtual void adjust() {}
> };
>
> //! base class for generic result groups
>diff -r -C 3 QuantLib-0.3.8/ql/instrument.hpp QuantLib-0.3.8-patched/ql/
>
>instrument.hpp
>*** QuantLib-0.3.8/ql/instrument.hpp Fri Sep 17 12:05:40 2004
>--- QuantLib-0.3.8-patched/ql/instrument.hpp Thu Feb 24 10:31:10 2005
>***************
>*** 137,142 ****
>--- 137,143 ----
> engine_->reset();
> setupArguments(engine_->arguments());
> engine_->arguments()->validate();
>+ engine_->arguments()->adjust();
> engine_->calculate();
> const Value* results = dynamic_cast<const Value*>(engine_-
>>results());
> QL_ENSURE(results != 0,
>
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
><a href="http://ads.osdn.com/?ad_ide95&alloc_id396&op=click">http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
>_______________________________________________
>Quantlib-users mailing list
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-users__________________________________________________________________
Tiscali Adsl 3 Mega Flat, 3 MESI GRATIS!
Con Tiscali Adsl 3 Mega Flat navighi in Rete alla supervelocita'
a soli 29.95 euro al mese senza limiti di tempo. Attivati entro
il 28 Febbraio 2005, 3 MESI sono GRATIS
Scopri come
http://abbonati.tiscali.it/adsl/sa/2flat_tc/