Finance - Maple Programming Help

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

Finance

 AmericanSwaption
 create a new American-style swaption

 Calling Sequence AmericanSwaption(irswap, earliestexercise, latestexercise, opts)

Parameters

 irswap - simple swap data structures; interest rate swap earliestexercise - a non-negative constant, a string containing a date specification in a format recognized by ParseDate, or a date data structure; the earliest date or time when the option can be exercised latestexercise - a non-negative constant, a string containing a date specification in a format recognized by ParseDate, or a date data structure; the maturity time or date opts - (optional) equation(s) of the form option = value where option is one of referencedate or daycounter; specify options for the AmericanSwaption 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 AmericanSwaption command creates a new American-style swaption with the specified payoff and maturity. The swaption can be exercised at any time between earliestexercise and latestexercise dates. This is the opposite of a European-style swaption, which can only be exercised on the date of expiration.
 • The parameter irswap is the underlying interest rate swap (see InterestRateSwap for more details).
 • The parameter earliestexercise specifies the earliest time or date when the option can be exercised. It can be given either as a non-negative constant or as a date in any of the formats recognized by the ParseDate command. If earlyexercise is given as a date, then the period between referencedate and earliestexercise will be converted to a fraction of the year according to the day count convention specified by daycounter. Typically the value of this option is $0$, which means that the option can be exercised at any time until the maturity. Note that the time of the earliest exercise must precede the maturity time.
 • The parameter latestexercise specifies the maturity time of the option. It can be given either as a non-negative constant or as a date in any of the formats recognized by the ParseDate command. If earlyexercise is given as a date, then the period between referencedate and latestexercise will be converted to a fraction of the year according to the day count convention specified by daycounter.
 • The LatticePrice command can be used to price an American-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.0,\mathrm{fixed_schedule},\mathrm{benchmark},\mathrm{floating_schedule},0.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.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.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.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}_{\mathrm{date}},\mathrm{cash_flows}\right)$
 ${\mathrm{dates}}{≔}\left[{\mathrm{date}}{,}{\mathrm{date}}{,}{\mathrm{date}}{,}{\mathrm{date}}{,}{\mathrm{date}}\right]$ (17)
 > $\mathrm{itm_swaption}≔\mathrm{AmericanSwaption}\left(\mathrm{itm_swap},\mathrm{AdvanceDate}\left(\mathrm{start},1,\mathrm{Days},\mathrm{EURIBOR}\right),\mathrm{AdvanceDate}\left({\mathrm{dates}}_{-2},1,\mathrm{Days},\mathrm{EURIBOR}\right)\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}}$ (18)
 > $\mathrm{atm_swaption}≔\mathrm{AmericanSwaption}\left(\mathrm{atm_swap},\mathrm{AdvanceDate}\left(\mathrm{start},1,\mathrm{Days},\mathrm{EURIBOR}\right),\mathrm{AdvanceDate}\left({\mathrm{dates}}_{-2},1,\mathrm{Days},\mathrm{EURIBOR}\right)\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}}$ (19)
 > $\mathrm{otm_swaption}≔\mathrm{AmericanSwaption}\left(\mathrm{otm_swap},\mathrm{AdvanceDate}\left(\mathrm{start},1,\mathrm{Days},\mathrm{EURIBOR}\right),\mathrm{AdvanceDate}\left({\mathrm{dates}}_{-2},1,\mathrm{Days},\mathrm{EURIBOR}\right)\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}}$ (20)

Price these swaptions using the Hull-White trinomial tree.

 > $a≔0.048696$
 ${a}{≔}{0.048696}$ (21)
 > $\mathrm{σ}≔0.0058904$
 ${\mathrm{\sigma }}{≔}{0.0058904}$ (22)
 > $\mathrm{model}≔\mathrm{HullWhiteModel}\left(\mathrm{discount_curve},a,\mathrm{σ}\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}}$ (23)
 > $\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}}$ (24)
 > $\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}}$ (25)

Price the swaptions using the tree constructed above.

 > $\mathrm{LatticePrice}\left(\mathrm{itm_swaption},\mathrm{short_rate_tree},\mathrm{discount_curve}\right)$
 ${54.64340244}$ (26)
 > $\mathrm{LatticePrice}\left(\mathrm{atm_swaption},\mathrm{short_rate_tree},\mathrm{discount_curve}\right)$
 ${29.47595615}$ (27)
 > $\mathrm{LatticePrice}\left(\mathrm{otm_swaption},\mathrm{short_rate_tree},\mathrm{discount_curve}\right)$
 ${15.16252551}$ (28)

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}}$ (29)
 > $\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}}$ (30)

Price your swaptions using the second tree.

 > $\mathrm{LatticePrice}\left(\mathrm{itm_swaption},\mathrm{tree},\mathrm{discount_curve}\right)$
 ${53.87370143}$ (31)
 > $\mathrm{LatticePrice}\left(\mathrm{atm_swaption},\mathrm{tree},\mathrm{discount_curve}\right)$
 ${21.69892190}$ (32)
 > $\mathrm{LatticePrice}\left(\mathrm{otm_swaption},\mathrm{tree},\mathrm{discount_curve}\right)$
 ${11.69368613}$ (33)

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[AmericanSwaption] command was introduced in Maple 15.