swaptionbybdt
Price swaption from Black-Derman-Toy interest-rate tree
Syntax
Description
[
prices swaption using a Black-Derman-Toy tree.Price
,PriceTree
]
= swaptionbybdt(BDTTree
,OptSpec
,Strike
,ExerciseDates
,Spread
,Settle
,Maturity
)
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.
[
adds optional name-value pair arguments.Price
,PriceTree
]
= swaptionbybdt(___,Name,Value
)
Examples
Price a 5-Year Call Swaption Using a BDT Interest-Rate Tree
This example shows how to price a 5-year call swaption using a BDT interest-rate tree. Assume that interest rate and volatility are fixed at 6% and 20% annually between the valuation date of the tree until its maturity. Build a tree with the following data.
Rates = 0.06 * ones (10,1); StartDates = [datetime(2007,1,1) ; datetime(2008,1,1) ; datetime(2009,1,1) ; datetime(2010,1,1) ; datetime(2011,1,1) ; datetime(2012,1,1) ; datetime(2013,1,1) ; datetime(2014,1,1) ; datetime(2015,1,1) ; datetime(2016,1,1)]; EndDates = [datetime(2008,1,1) ; datetime(2009,1,1) ; datetime(2010,1,1) ; datetime(2011,1,1) ; datetime(2012,1,1) ; datetime(2013,1,1) ; datetime(2014,1,1) ; datetime(2015,1,1) ; datetime(2016,1,1) ; datetime(2017,1,1)]; ValuationDate = datetime(2007,1,1); Compounding = 1; % define the RateSpec RateSpec = intenvset('Rates', Rates, 'StartDates', StartDates, 'EndDates', EndDates, ... 'Compounding', Compounding); % use VolSpec to compute interest-rate volatility Volatility = 0.20 * ones (10,1); VolSpec = bdtvolspec(ValuationDate,... EndDates, Volatility); % use TimeSpec to specify the structure of the time layout for a BDT tree TimeSpec = bdttimespec(ValuationDate, EndDates, Compounding); % build the BDT tree BDTTree = bdttree(VolSpec, RateSpec, TimeSpec); % use the following swaption arguments ExerciseDates = datetime(2012,1,1); SwapSettlement = ExerciseDates; SwapMaturity = datetime(2015,1,1); Spread = 0; SwapReset = 1; Principal = 100; OptSpec = 'call'; Strike =.062; Basis = 1; % price the swaption [Price, PriceTree] = swaptionbybdt(BDTTree, OptSpec, Strike, ExerciseDates, ... Spread, SwapSettlement, SwapMaturity, 'SwapReset', SwapReset, ... 'Basis', Basis, 'Principal', Principal)
Price = 2.0592
PriceTree = struct with fields:
FinObj: 'BDTPriceTree'
tObs: [0 1 2 3 4 5 6 7 8 9 10]
PTree: {[2.0592] [0.9218 3.4436] [0.2189 1.7137 5.6694] [0 0.4549 3.1715 9.1499] [0 0 0.9524 5.8347 14.3819] [0 0 0 2.0127 10.6474 21.7783] [0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0]}
Price a 5-Year Call Swaption with Receiving and Paying Legs Using a BDT Interest-Rate Tree
This example shows how to price a 5-year call swaption with receiving and paying legs using a BDT interest-rate tree. Assume that interest rate and volatility are fixed at 6% and 20% annually between the valuation date of the tree until its maturity. Build a tree with the following data.
Rates = 0.06 * ones (10,1); StartDates = [datetime(2007,1,1) ; datetime(2008,1,1) ; datetime(2009,1,1) ; datetime(2010,1,1) ; datetime(2011,1,1) ; datetime(2012,1,1) ; datetime(2013,1,1) ; datetime(2014,1,1) ; datetime(2015,1,1) ; datetime(2016,1,1)]; EndDates = [datetime(2008,1,1) ; datetime(2009,1,1) ; datetime(2010,1,1) ; datetime(2011,1,1) ; datetime(2012,1,1) ; datetime(2013,1,1) ; datetime(2014,1,1) ; datetime(2015,1,1) ; datetime(2016,1,1) ; datetime(2017,1,1)]; ValuationDate = datetime(2007,1,1); Compounding = 1;
Define the RateSpec
.
RateSpec = intenvset('Rates', Rates, 'StartDates', StartDates, 'EndDates', EndDates, ... 'Compounding', Compounding)
RateSpec = struct with fields:
FinObj: 'RateSpec'
Compounding: 1
Disc: [10x1 double]
Rates: [10x1 double]
EndTimes: [10x1 double]
StartTimes: [10x1 double]
EndDates: [10x1 double]
StartDates: [10x1 double]
ValuationDate: 733043
Basis: 0
EndMonthRule: 1
Use VolSpec
to compute interest-rate volatility.
Volatility = 0.20 * ones (10,1); VolSpec = bdtvolspec(ValuationDate,EndDates, Volatility);
Use TimeSpec
to specify the structure of the time layout for a BDT tree.
TimeSpec = bdttimespec(ValuationDate, EndDates, Compounding);
Build the BDT tree.
BDTTree = bdttree(VolSpec, RateSpec, TimeSpec)
BDTTree = struct with fields:
FinObj: 'BDTFwdTree'
VolSpec: [1x1 struct]
TimeSpec: [1x1 struct]
RateSpec: [1x1 struct]
tObs: [0 1 2 3 4 5 6 7 8 9]
dObs: [733043 733408 733774 734139 734504 734869 735235 735600 735965 736330]
TFwd: {[10x1 double] [9x1 double] [8x1 double] [7x1 double] [6x1 double] [5x1 double] [4x1 double] [3x1 double] [2x1 double] [9]}
CFlowT: {[10x1 double] [9x1 double] [8x1 double] [7x1 double] [6x1 double] [5x1 double] [4x1 double] [3x1 double] [2x1 double] [10]}
FwdTree: {1x10 cell}
Define the swaption arguments.
ExerciseDates = datetime(2012,1,1); SwapSettlement = ExerciseDates; SwapMaturity = datetime(2015,1,1); Spread = 0; SwapReset = [1 1]; % 1st column represents receiving leg, 2nd column represents paying leg Principal = 100; OptSpec = 'call'; Strike=.062; Basis= [2 4]; % 1st column represents receiving leg, 2nd column represents paying leg
Price the swaption.
[Price, PriceTree] = swaptionbybdt(BDTTree, OptSpec, Strike, ExerciseDates, ... Spread, SwapSettlement, SwapMaturity, 'SwapReset', SwapReset, ... 'Basis', Basis, 'Principal', Principal)
Price = 2.0592
PriceTree = struct with fields:
FinObj: 'BDTPriceTree'
tObs: [0 1 2 3 4 5 6 7 8 9 10]
PTree: {[2.0592] [0.9218 3.4436] [0.2189 1.7137 5.6694] [0 0.4549 3.1715 9.1499] [0 0 0.9524 5.8347 14.3819] [0 0 0 2.0127 10.6474 21.7783] [0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0]}
Input Arguments
BDTTree
— Interest-rate tree structure
structure
Interest-rate tree structure, specified by using bdttree
.
Data Types: struct
OptSpec
— Definition of option
character vector with values 'call'
or 'put'
| cell array of character vector with values 'call'
or 'put'
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
— Strike swap rate values
decimal
Strike swap rate values, specified as a NINST
-by-1
vector.
Data Types: double
ExerciseDates
— Exercise dates for swaption
datetime array | string array | date character vector
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 aNINST
-by-1
vector of exercise dates. Each row is the schedule for one option. When using a European option, there is only oneExerciseDate
on the option expiry date.For an American option,
ExerciseDates
are aNINST
-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 ifExerciseDates
isNINST
-by-1
, the option can be exercised between theValuationDate
of the tree and the single listedExerciseDate
.
To support existing code, swaptionbybdt
also
accepts serial date numbers as inputs, but they are not recommended.
Spread
— Number of basis points over reference rate
numeric
Number of basis points over the reference rate, specified as
a NINST
-by-1
vector.
Data Types: double
Settle
— Settlement date
datetime array | string array | date character vector
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 BDT tree. The swap argument
Settle
is ignored. The underlying swap starts at the maturity of
the swaption.
To support existing code, swaptionbybdt
also
accepts serial date numbers as inputs, but they are not recommended.
Maturity
— Maturity date for swap
datetime array | string array | date character vector
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, swaptionbybdt
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] = swaptionbybdt(BDTTree,OptSpec,
ExerciseDates,Spread,Settle,Maturity,'SwapReset',4,'Basis',5,'Principal',10000)
AmericanOpt
— Option type
0
(European) (default) | integer with values 0
or 1
(Optional) Option type, specified as the comma-separated pair consisting of
'AmericanOpt'
and
NINST
-by-1
positive integer flags with values:
0
— European1
— American
Data Types: double
SwapReset
— Reset frequency per year for underlying swap
1
(default) | numeric
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
Basis
— Day-count basis of instrument
0
(actual/actual) (default) | integer from 0
to 13
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
Principal
— Notional principal amount
100
(default) | numeric
Notional principal amount, specified as the comma-separated pair consisting of
'Principal'
and a
NINST
-by-1
vector.
Data Types: double
Options
— Derivatives pricing options structure
structure
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
Price
— Expected prices of swaptions at time 0
vector
Expected prices of the swaptions at time 0, returned as a NINST
-by-1
vector.
PriceTree
— Tree structure of instrument prices
structure
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
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 R2006aR2022b: Serial date numbers not recommended
Although swaptionbybdt
supports serial date numbers,
datetime
values are recommended instead. The
datetime
data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.
To convert serial date numbers or text to datetime
values, use the datetime
function. For example:
t = datetime(738427.656845093,"ConvertFrom","datenum"); y = year(t)
y = 2021
There are no plans to remove support for serial date number inputs.
See Also
bdttree
| instswaption
| swapbybdt
| Swaption
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)