 Finance - Maple Programming Help

Home : Support : Online Help : Mathematics : Finance : Financial Instruments : Finance/BermudanSwaption

Finance

 BermudanSwaption
 create a new Bermudan swaption

 Calling Sequence BermudanSwaption(irswap, exercisetimes, opts) BermudanSwaption(irswap, exercisedates, opts)

Parameters

 irswap - interest rate swap data structures; interest rate swap exercisedates - list of dates given in a format recognized by ParseDate or a date data structure; dates when the option can be exercised exercisetimes - list of non-negative constants; times when the option can be exercised opts - (optional) equation(s) of the form option = value where option is one of referencedate or daycounter; specify options for the BermudanSwaption command

Options

 • referencedate = a string containing a date specification in a format recognized by ParseDate or a date data structure -- This option provides the evaluation date. It is set to the global evaluation date by default.
 • daycounter = a name representing a supported day counter (e.g. ISDA, Simple) or a day counter data structure created using the DayCounter constructor -- This option provides a day counter that will be used to convert the period between two dates to a fraction of the year. This option is used only if one of earliestexercise or latestexercise is specified as a date.

Description

 • The BermudanSwaption command creates a new Bermudan-style swaption on the specified interest rate swap. This swaption can be exercised at any time or date given in the exercisetimes or exercisedates list.
 • The parameter irswap is the underlying interest rate swap (see InterestRateSwap for more details).
 • The parameter exercisedates specifies the dates when the swaption can be exercised. It has to be given as a list of dates in any of the formats recognized by the ParseDate command. The exercise times will be computed by converting the period between referencedate and the corresponding exercise date to a fraction of the year according to the day count convention specified by daycounter. Alternatively, one can specify exercise times directly using the exercisetimes parameter. In this case the referencedate and daycounter options are ignored.
 • The LatticePrice command can be used to price a Bermudan-style swaption using any given binomial or trinomial tree.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $\mathrm{SetEvaluationDate}\left("November 17, 2006"\right):$
 > $\mathrm{EvaluationDate}\left(\right)$
 ${"November 17, 2006"}$ (1)
 > $\mathrm{nominal}≔1000.0$
 ${\mathrm{nominal}}{≔}{1000.0}$ (2)
 > $\mathrm{fixing_days}≔2$
 ${\mathrm{fixing_days}}{≔}{2}$ (3)
 > $\mathrm{start}≔\mathrm{AdvanceDate}\left(1,\mathrm{Years},\mathrm{EURIBOR}\right)$
 ${\mathrm{start}}{≔}{"November 17, 2007"}$ (4)
 > $\mathrm{maturity}≔\mathrm{AdvanceDate}\left(\mathrm{start},5,\mathrm{Years},\mathrm{EURIBOR}\right)$
 ${\mathrm{maturity}}{≔}{"November 17, 2012"}$ (5)
 > $\mathrm{discount_curve}≔\mathrm{ForwardCurve}\left(0.04875825,'\mathrm{daycounter}'=\mathrm{Actual365Fixed}\right)$
 ${\mathrm{discount_curve}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (6)
 > $\mathrm{fixed_schedule}≔\mathrm{Schedule}\left(\mathrm{start},\mathrm{maturity},\mathrm{Annual},'\mathrm{convention}'=\mathrm{Unadjusted},'\mathrm{calendar}'=\mathrm{EURIBOR}\right)$
 ${\mathrm{fixed_schedule}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (7)
 > $\mathrm{floating_schedule}≔\mathrm{Schedule}\left(\mathrm{start},\mathrm{maturity},\mathrm{Semiannual},'\mathrm{convention}'=\mathrm{ModifiedFollowing},'\mathrm{calendar}'=\mathrm{EURIBOR}\right)$
 ${\mathrm{floating_schedule}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (8)
 > $\mathrm{benchmark}≔\mathrm{BenchmarkRate}\left(6,\mathrm{Months},\mathrm{EURIBOR},0.04875825\right)$
 ${\mathrm{benchmark}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (9)

Construct an interest rate swap receiving the fixed-rate payments in exchange for the floating-rate payment.

 > $\mathrm{swap}≔\mathrm{InterestRateSwap}\left(\mathrm{nominal},0.,\mathrm{fixed_schedule},\mathrm{benchmark},\mathrm{floating_schedule},0.\right)$
 ${\mathrm{swap}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (10)

Compute the at-the-money rate for this interest rate swap.

 > $\mathrm{atm_rate}≔\mathrm{FairRate}\left(\mathrm{swap},\mathrm{discount_curve}\right)$
 ${\mathrm{atm_rate}}{≔}{0.04995609574}$ (11)

Construct three swaps.

 > $\mathrm{itm_swap}≔\mathrm{InterestRateSwap}\left(\mathrm{nominal},0.8\mathrm{atm_rate},\mathrm{fixed_schedule},\mathrm{benchmark},\mathrm{floating_schedule},0.\right)$
 ${\mathrm{itm_swap}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (12)
 > $\mathrm{atm_swap}≔\mathrm{InterestRateSwap}\left(\mathrm{nominal},1.0\mathrm{atm_rate},\mathrm{fixed_schedule},\mathrm{benchmark},\mathrm{floating_schedule},0.\right)$
 ${\mathrm{atm_swap}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (13)
 > $\mathrm{otm_swap}≔\mathrm{InterestRateSwap}\left(\mathrm{nominal},1.2\mathrm{atm_rate},\mathrm{fixed_schedule},\mathrm{benchmark},\mathrm{floating_schedule},0.\right)$
 ${\mathrm{otm_swap}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (14)

Here are cash flows for the paying leg of your interest rate swap.

 > $\mathrm{cash_flows}≔\mathrm{CashFlows}\left(\mathrm{itm_swap},\mathrm{paying}\right)$
 ${\mathrm{cash_flows}}{≔}\left[{\mathrm{39.97833882 on \text{'}November 17, 2008\text{'}}}{,}{\mathrm{39.95141436 on \text{'}November 17, 2009\text{'}}}{,}{\mathrm{39.96487659 on \text{'}November 17, 2010\text{'}}}{,}{\mathrm{39.96487659 on \text{'}November 17, 2011\text{'}}}{,}{\mathrm{39.97833882 on \text{'}November 19, 2012\text{'}}}\right]$ (15)

Here are cash flows for the receiving leg of your interest rate swap.

 > $\mathrm{CashFlows}\left(\mathrm{itm_swap},\mathrm{receiving}\right)$
 $\left[{\mathrm{24.55793340 on \text{'}May 19, 2008\text{'}}}{,}{\mathrm{24.54222773 on \text{'}November 17, 2008\text{'}}}{,}{\mathrm{24.59383300 on \text{'}May 18, 2009\text{'}}}{,}{\mathrm{24.74716833 on \text{'}November 17, 2009\text{'}}}{,}{\mathrm{24.47342475 on \text{'}May 17, 2010\text{'}}}{,}{\mathrm{24.88406756 on \text{'}November 17, 2010\text{'}}}{,}{\mathrm{24.47342475 on \text{'}May 17, 2011\text{'}}}{,}{\mathrm{24.88406756 on \text{'}November 17, 2011\text{'}}}{,}{\mathrm{24.55868130 on \text{'}May 17, 2012\text{'}}}{,}{\mathrm{25.08832826 on \text{'}November 19, 2012\text{'}}}\right]$ (16)

These are days when coupon payments are scheduled to occur.

 > $\mathrm{dates}≔\mathrm{map}\left(t↦t\left[\mathrm{date}\right],\mathrm{cash_flows}\right)$
 ${\mathrm{dates}}{≔}\left[{\mathrm{date}}{,}{\mathrm{date}}{,}{\mathrm{date}}{,}{\mathrm{date}}{,}{\mathrm{date}}\right]$ (17)

Set up exercise dates.

 > $\mathrm{exercise_dates}≔\mathrm{map}\left(t↦\mathrm{AdvanceDate}\left(t,1,\mathrm{Days},\mathrm{EURIBOR}\right),\left[\mathrm{start},\mathrm{op}\left(1..-2,\mathrm{dates}\right)\right]\right)$
 ${\mathrm{exercise_dates}}{≔}\left[{"November 19, 2007"}{,}{"November 18, 2008"}{,}{"November 18, 2009"}{,}{"November 18, 2010"}{,}{"November 18, 2011"}\right]$ (18)

Construct three swaptions that can be exercised on any of the previous dates.

 > $\mathrm{itm_swaption}≔\mathrm{BermudanSwaption}\left(\mathrm{itm_swap},\mathrm{exercise_dates}\right)$
 ${\mathrm{itm_swaption}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (19)
 > $\mathrm{atm_swaption}≔\mathrm{BermudanSwaption}\left(\mathrm{atm_swap},\mathrm{exercise_dates}\right)$
 ${\mathrm{atm_swaption}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (20)
 > $\mathrm{otm_swaption}≔\mathrm{BermudanSwaption}\left(\mathrm{otm_swap},\mathrm{exercise_dates}\right)$
 ${\mathrm{otm_swaption}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (21)

Price these swaptions using the Hull-White trinomial tree.

 > $a≔0.048696$
 ${a}{≔}{0.048696}$ (22)
 > $\mathrm{\sigma }≔0.0058904$
 ${\mathrm{\sigma }}{≔}{0.0058904}$ (23)
 > $\mathrm{model}≔\mathrm{HullWhiteModel}\left(\mathrm{discount_curve},a,\mathrm{\sigma }\right)$
 ${\mathrm{model}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (24)
 > $\mathrm{time_grid}≔\mathrm{TimeGrid}\left(\mathrm{YearFraction}\left(\mathrm{maturity}\right)+0.5,100\right)$
 ${\mathrm{time_grid}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (25)
 > $\mathrm{short_rate_tree}≔\mathrm{ShortRateTree}\left(\mathrm{model},\mathrm{time_grid}\right)$
 ${\mathrm{short_rate_tree}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (26)

Price our swaptions using the tree constructed above.

 > $\mathrm{LatticePrice}\left(\mathrm{itm_swaption},\mathrm{short_rate_tree},\mathrm{discount_curve}\right)$
 ${42.37568409}$ (27)
 > $\mathrm{LatticePrice}\left(\mathrm{atm_swaption},\mathrm{short_rate_tree},\mathrm{discount_curve}\right)$
 ${13.41345287}$ (28)
 > $\mathrm{LatticePrice}\left(\mathrm{otm_swaption},\mathrm{short_rate_tree},\mathrm{discount_curve}\right)$
 ${2.795526880}$ (29)

You can also price these swaptions using an explicitly constructed trinomial tree.

 > $\mathrm{ou_process}≔\mathrm{OrnsteinUhlenbeckProcess}\left(0.04875,0.04875,1.0,0.3\right)$
 ${\mathrm{ou_process}}{≔}{\mathrm{_X0}}$ (30)
 > $\mathrm{tree}≔\mathrm{ShortRateTree}\left(\mathrm{ou_process},\mathrm{time_grid}\right)$
 ${\mathrm{tree}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (31)

Price the swaptions using the second tree.

 > $\mathrm{LatticePrice}\left(\mathrm{itm_swaption},\mathrm{tree},\mathrm{discount_curve}\right)$
 ${41.39592398}$ (32)
 > $\mathrm{LatticePrice}\left(\mathrm{atm_swaption},\mathrm{tree},\mathrm{discount_curve}\right)$
 ${1.528598823}$ (33)
 > $\mathrm{LatticePrice}\left(\mathrm{otm_swaption},\mathrm{tree},\mathrm{discount_curve}\right)$
 ${0.}$ (34)

References

 Brigo, D., Mercurio, F., Interest Rate Models: Theory and Practice. New York: Springer-Verlag, 2001.
 Hull, J., Options, Futures, and Other Derivatives, 5th. edition. Upper Saddle River, New Jersey: Prentice Hall, 2003.

Compatibility

 • The Finance[BermudanSwaption] command was introduced in Maple 15.