Main Content

swaptionbyhw

Price swaption from Hull-White interest-rate tree

Description

example

[Price,PriceTree] = swaptionbyhw(HWTree,OptSpec,Strike,ExerciseDates,Spread,Settle,Maturity) prices swaption using a Hull-White tree.

Note

Alternatively, you can use the Swaption object to price swaption instruments. For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

example

[Price,PriceTree] = swaptionbyhw(___,Name,Value) adds optional name-value pair arguments.

Examples

collapse all

This example shows how to price a 3-year put swaption using an HW interest-rate tree with the following data.

Rates =0.075 * ones (10,1);   
Compounding = 2;  
StartDates = [datetime(2007,1,1);datetime(2007,7,1);datetime(2008,1,1);datetime(2008,7,1);datetime(2009,1,1);datetime(2009,7,1);datetime(2010,1,1);datetime(2010,7,1);datetime(2011,1,1);datetime(2011,7,1)];
EndDates = [datetime(2007,7,1);datetime(2008,1,1);datetime(2008,7,1);datetime(2009,1,1);datetime(2009,7,1);datetime(2010,1,1);datetime(2010,7,1);datetime(2011,1,1);datetime(2011,7,1);datetime(2012,1,1)];
ValuationDate = datetime(2007,1,1);      

% Define the RatesSpec
RateSpec = intenvset('Rates', Rates, 'StartDates', StartDates, 'EndDates',...
EndDates, 'Compounding', Compounding);  

% Use HWVolSpec to compute the interest-rate volatility
Volatility = 0.05*ones(10,1);
AlphaCurve = 0.01*ones(10,1);
AlphaDates = EndDates;
HWVolSpec = hwvolspec(ValuationDate, EndDates, Volatility, AlphaDates, AlphaCurve);

% Use HWTimeSpec to specify the structure of the time layout for an HW interest-rate tree
HWTimeSpec = hwtimespec(ValuationDate, EndDates, Compounding);

% Build the HW tree
HWTree = hwtree(HWVolSpec, RateSpec, HWTimeSpec); 

% Use the following arguments for a 1-year swap and 3-year swaption
ExerciseDates = datetime(2010,1,1);
SwapSettlement = ExerciseDates;
SwapMaturity   = datetime(2012,1,1);
Spread = 0;
SwapReset = 2 ; 
Principal = 100;
OptSpec = 'put';  
Strike= 0.04;
Basis=1;

% Price the swaption
PriceSwaption = swaptionbyhw(HWTree, OptSpec, Strike, ExerciseDates, ...
Spread, SwapSettlement, SwapMaturity,'SwapReset', SwapReset, ...
'Basis', Basis,'Principal', Principal)
PriceSwaption = 2.9201

This example shows how to price a 3-year put swaption with receiving and paying legs using an HW interest-rate tree with the following data.

Rates =0.075 * ones (10,1);   
Compounding = 2;    
StartDates = [datetime(2007,1,1);datetime(2007,7,1);datetime(2008,1,1);datetime(2008,7,1);datetime(2009,1,1);datetime(2009,7,1);datetime(2010,1,1);datetime(2010,7,1);datetime(2011,1,1);datetime(2011,7,1)];
EndDates = [datetime(2007,7,1);datetime(2008,1,1);datetime(2008,7,1);datetime(2009,1,1);datetime(2009,7,1);datetime(2010,1,1);datetime(2010,7,1);datetime(2011,1,1);datetime(2011,7,1);datetime(2012,1,1)];
ValuationDate = datetime(2007,1,1);

Define the RatesSpec.

RateSpec = intenvset('Rates', Rates, 'StartDates', StartDates, 'EndDates',...
EndDates, 'Compounding', Compounding);

Use HWVolSpec to compute the interest-rate volatility.

Volatility = 0.05*ones(10,1);
AlphaCurve = 0.01*ones(10,1);
AlphaDates = EndDates;
HWVolSpec = hwvolspec(ValuationDate, EndDates, Volatility, AlphaDates, AlphaCurve);

Use HWTimeSpec to specify the structure of the time layout for an HW interest-rate tree.

HWTimeSpec = hwtimespec(ValuationDate, EndDates, Compounding);

Build the HW tree.

HWTree = hwtree(HWVolSpec, RateSpec, HWTimeSpec);

Use the following arguments for a 1-year swap and 3-year swaption

ExerciseDates = datetime(2010,1,1);
SwapSettlement = ExerciseDates;
SwapMaturity   = datetime(2012,1,1);
Spread = 0;
SwapReset = [2 2]; % 1st column represents receiving leg, 2nd column represents paying leg 
Principal = 100;
OptSpec = 'put';  
Strike= 0.04;
Basis= [1 3];    % 1st column represents receiving leg, 2nd column represents paying leg

Price the swaption.

PriceSwaption = swaptionbyhw(HWTree, OptSpec, Strike, ExerciseDates, ...
Spread, SwapSettlement, SwapMaturity,'SwapReset', SwapReset, ...
'Basis', Basis,'Principal', Principal)
PriceSwaption = 2.9201

Input Arguments

collapse all

Interest-rate tree structure, specified by using hwtree.

Data Types: struct

Definition of the option as 'call' or 'put', specified as a NINST-by-1 cell array of character vectors. For more information, see More About.

Data Types: char | cell

Strike swap rate values, specified as a NINST-by-1 vector.

Data Types: double

Exercise dates for the swaption, specified as a NINST-by-1 vector or a NINST-by-2 vector using a datetime array, string array, or date character vectors, depending on the option type.

  • For a European option, ExerciseDates are a NINST-by-1 vector of exercise dates. Each row is the schedule for one option. When using a European option, there is only one ExerciseDate on the option expiry date.

  • For an American option, ExerciseDates are a NINST-by-2 vector of exercise date boundaries. For each instrument, the option can be exercised on any coupon date between or including the pair of dates on that row. If only one non-NaN date is listed, or if ExerciseDates is NINST-by-1, the option can be exercised between the ValuationDate of the tree and the single listed ExerciseDate.

To support existing code, swaptionbyhw also accepts serial date numbers as inputs, but they are not recommended.

Number of basis points over the reference rate, specified as a NINST-by-1 vector.

Data Types: double

Settlement date (representing the settle date for each swap), specified as a NINST-by-1 vector using a datetime array, string array, or date character vectors. The Settle date for every swaption is set to the ValuationDate of the HW tree. The swap argument Settle is ignored. The underlying swap starts at the maturity of the swaption.

To support existing code, swaptionbyhw also accepts serial date numbers as inputs, but they are not recommended.

Maturity date for each swap, specified as a NINST-by-1 vector using a datetime array, string array, or date character vectors.

To support existing code, swaptionbyhw also accepts serial date numbers as inputs, but they are not recommended.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: [Price,PriceTree] = swaptionbyhw(HWTree,OptSpec, ExerciseDates,Spread,Settle,Maturity,'SwapReset',4,'Basis',5,'Principal',10000)

(Optional) Option type, specified as the comma-separated pair consisting of 'AmericanOpt' and NINST-by-1 positive integer flags with values:

  • 0 — European

  • 1 — American

Data Types: double

Reset frequency per year for the underlying swap, specified as the comma-separated pair consisting of 'SwapReset' and a NINST-by-1 vector or NINST-by-2 matrix representing the reset frequency per year for each leg. If SwapReset is NINST-by-2, the first column represents the receiving leg, while the second column represents the paying leg.

Data Types: double

Day-count basis representing the basis used when annualizing the input forward rate tree for each instrument, specified as the comma-separated pair consisting of 'Basis' and a NINST-by-1 vector or NINST-by-2 matrix representing the basis for each leg. If Basis is NINST-by-2, the first column represents the receiving leg, while the second column represents the paying leg.

  • 0 = actual/actual

  • 1 = 30/360 (SIA)

  • 2 = actual/360

  • 3 = actual/365

  • 4 = 30/360 (PSA)

  • 5 = 30/360 (ISDA)

  • 6 = 30/360 (European)

  • 7 = actual/365 (Japanese)

  • 8 = actual/actual (ICMA)

  • 9 = actual/360 (ICMA)

  • 10 = actual/365 (ICMA)

  • 11 = 30/360E (ICMA)

  • 12 = actual/365 (ISDA)

  • 13 = BUS/252

For more information, see Basis.

Data Types: double

Notional principal amount, specified as the comma-separated pair consisting of 'Principal' and a NINST-by-1 vector.

Data Types: double

Derivatives pricing options structure, specified as the comma-separated pair consisting of 'Options' and a structure obtained from using derivset.

Data Types: struct

Output Arguments

collapse all

Expected prices of the swaptions at time 0, returned as a NINST-by-1 vector.

Tree structure of instrument prices, returned as a MATLAB® structure of trees containing vectors of swaption instrument prices and a vector of observation times for each node. Within PriceTree:

  • PriceTree.PTree contains the clean prices.

  • PriceTree.tObs contains the observation times.

More About

collapse all

Call Swaption

A call swaption or payer swaption allows the option buyer to enter into an interest-rate swap in which the buyer of the option pays the fixed rate and receives the floating rate.

Put Swaption

A put swaption or receiver swaption allows the option buyer to enter into an interest-rate swap in which the buyer of the option receives the fixed rate and pays the floating rate.

Version History

Introduced before R2006a

expand all