# swaptionbyblk

Price European swaption instrument using Black model

## Syntax

## Description

prices swaptions using the Black option pricing model. `Price`

= swaptionbyblk(`RateSpec`

,`OptSpec`

,`Strike`

,`Settle`

,`ExerciseDates`

,`Maturity`

,`Volatility`

)

adds optional name-value pair arguments. `Price`

= swaptionbyblk(___,`Name,Value`

)

## Examples

### Price a European Swaption Using the Black Model Where the Yield Curve is Flat at 6%

Price a European swaption that gives the holder the right to enter in five years into a three-year paying swap where a fixed-rate of 6.2% is paid and floating is received. Assume that the yield curve is flat at 6% per annum with continuous compounding, the volatility of the swap rate is 20%, the principal is $100, and payments are exchanged semiannually.

Create the `RateSpec`

.

Rate = 0.06; Compounding = -1; ValuationDate = 'Jan-1-2010'; EndDates = 'Jan-1-2020'; Basis = 1; RateSpec = intenvset('ValuationDate', ValuationDate,'StartDates', ValuationDate, ... 'EndDates', EndDates, 'Rates', Rate, 'Compounding', Compounding, 'Basis', Basis);

Price the swaption using the Black model.

Settle = 'Jan-1-2011'; ExerciseDates = 'Jan-1-2016'; Maturity = 'Jan-1-2019'; Reset = 2; Principal = 100; Strike = 0.062; Volatility = 0.2; OptSpec = 'call'; Price= swaptionbyblk(RateSpec, OptSpec, Strike, Settle, ExerciseDates, Maturity, ... Volatility, 'Reset', Reset, 'Principal', Principal, 'Basis', Basis)

Price = 2.0710

### Price a European Swaption with Receiving and Paying Legs Using the Black Model Where the Yield Curve is 6%

This example shows Price a European swaption with receiving and paying legs that gives the holder the right to enter in five years into a three-year paying swap where a fixed-rate of 6.2% is paid and floating is received. Assume that the yield curve is flat at 6% per annum with continuous compounding, the volatility of the swap rate is 20%, the principal is $100, and payments are exchanged semiannually.

Rate = 0.06; Compounding = -1; ValuationDate = 'Jan-1-2010'; EndDates = 'Jan-1-2020'; Basis = 1;

**Define the RateSpec.**

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

**Define the swaption arguments.**

Settle = 'Jan-1-2011'; ExerciseDates = 'Jan-1-2016'; Maturity = 'Jan-1-2019'; Reset = [2 4]; % 1st column represents receiving leg, 2nd column represents paying leg Principal = 100; Strike = 0.062; Volatility = 0.2; OptSpec = 'call'; Basis = [1 3]; % 1st column represents receiving leg, 2nd column represents paying leg

**Price the swaption.**

Price= swaptionbyblk(RateSpec,OptSpec,Strike,Settle,ExerciseDates,Maturity,Volatility, ... 'Reset',Reset,'Principal',Principal,'Basis',Basis)

Price = 1.6494

### Price a European Swaption Using the Black Model Where the Yield Curve Is Incrementally Increasing

Price a European swaption that gives the holder the right to enter into a 5-year receiving swap in a year, where a fixed rate of 3% is received and floating is paid. Assume that the 1-year, 2-year, 3-year, 4-year and 5- year zero rates are 3%, 3.4%, 3.7%, 3.9% and 4% with continuous compounding. The swap rate volatility is 21%, the principal is $1000, and payments are exchanged semiannually.

Create the `RateSpec`

.

ValuationDate = 'Jan-1-2010'; EndDates = {'Jan-1-2011';'Jan-1-2012';'Jan-1-2013';'Jan-1-2014';'Jan-1-2015'}; Rates = [0.03; 0.034 ; 0.037; 0.039; 0.04;]; Compounding = -1; Basis = 1; RateSpec = intenvset('ValuationDate', ValuationDate, 'StartDates', ValuationDate, ... 'EndDates', EndDates, 'Rates', Rates, 'Compounding', Compounding,'Basis', Basis)

`RateSpec = `*struct with fields:*
FinObj: 'RateSpec'
Compounding: -1
Disc: [5x1 double]
Rates: [5x1 double]
EndTimes: [5x1 double]
StartTimes: [5x1 double]
EndDates: [5x1 double]
StartDates: 734139
ValuationDate: 734139
Basis: 1
EndMonthRule: 1

Price the swaption using the Black model.

Settle = 'Jan-1-2011'; ExerciseDates = 'Jan-1-2012'; Maturity = 'Jan-1-2017'; Strike = 0.03; Volatility = 0.21; Principal =1000; Reset = 2; OptSpec = 'put'; Price = swaptionbyblk(RateSpec, OptSpec, Strike, Settle, ExerciseDates, ... Maturity, Volatility,'Basis', Basis, 'Reset', Reset,'Principal', Principal)

Price = 0.5771

### Price a Swaption Using a Different Curve to Generate the Future Forward Rates

Define the OIS and Libor curves.

```
Settle = datenum('15-Mar-2013');
CurveDates = daysadd(Settle,360*[1/12 2/12 3/12 6/12 1 2 3 4 5 7 10],1);
OISRates = [.0018 .0019 .0021 .0023 .0031 .006 .011 .017 .021 .026 .03]';
LiborRates = [.0045 .0047 .005 .0055 .0075 .0109 .0162 .0216 .0262 .0309 .0348]';
```

Create an associated `RateSpec`

for the OIS and Libor curves.

OISCurve = intenvset('Rates',OISRates,'StartDate',Settle,'EndDates',CurveDates,'Compounding',2,'Basis',1); LiborCurve = intenvset('Rates',LiborRates,'StartDate',Settle,'EndDates',CurveDates,'Compounding',2,'Basis',1);

Define the swaption instruments.

ExerciseDate = '15-Mar-2018'; Maturity = {'15-Mar-2020';'15-Mar-2023'}; OptSpec = 'call'; Strike = 0.04; BlackVol = 0.2;

Price the swaption instruments using the term structure `OISCurve`

both for discounting the cash flows and generating the future forward rates.

`Price = swaptionbyblk(OISCurve, OptSpec, Strike, Settle, ExerciseDate, Maturity, BlackVol,'Reset',1)`

`Price = `*2×1*
1.0956
2.6944

Price the swaption instruments using the term structure `LiborCurve`

to generate the future forward rates. The term structure `OISCurve`

is used for discounting the cash flows.

PriceLC = swaptionbyblk(OISCurve, OptSpec, Strike, Settle, ExerciseDate, Maturity, BlackVol,'ProjectionCurve',LiborCurve,'Reset',1)

`PriceLC = `*2×1*
1.5346
3.8142

### Price a Swaption Using the Shifted Black Model

Create the `RateSpec`

.

ValuationDate = 'Jan-1-2016'; EndDates = {'Jan-1-2017';'Jan-1-2018';'Jan-1-2019';'Jan-1-2020';'Jan-1-2021'}; Rates = [-0.02; 0.024 ; 0.047; 0.090; 0.12;]/100; Compounding = 1; Basis = 1; RateSpec = intenvset('ValuationDate',ValuationDate,'StartDates',ValuationDate, ... 'EndDates',EndDates,'Rates',Rates,'Compounding',Compounding,'Basis',Basis)

`RateSpec = `*struct with fields:*
FinObj: 'RateSpec'
Compounding: 1
Disc: [5x1 double]
Rates: [5x1 double]
EndTimes: [5x1 double]
StartTimes: [5x1 double]
EndDates: [5x1 double]
StartDates: 736330
ValuationDate: 736330
Basis: 1
EndMonthRule: 1

Price the swaption with a negative strike using the Shifted Black model.

Settle = 'Jan-1-2016'; ExerciseDates = 'Jan-1-2017'; Maturity = 'Jan-1-2020'; Strike = -0.003; % Set -0.3 percent strike. ShiftedBlackVolatility = 0.31; Principal = 1000; Reset = 1; OptSpec = 'call'; Shift = 0.008; % Set 0.8 percent shift. Price = swaptionbyblk(RateSpec,OptSpec,Strike,Settle,ExerciseDates, ... Maturity,ShiftedBlackVolatility,'Basis',Basis,'Reset',Reset,... 'Principal',Principal,'Shift',Shift)

Price = 12.8301

### Price Swaptions Using the Shifted Black Model with a Vector of Shifts

Create the `RateSpec`

.

ValuationDate = 'Jan-1-2016'; EndDates = {'Jan-1-2017';'Jan-1-2018';'Jan-1-2019';'Jan-1-2020';'Jan-1-2021'}; Rates = [-0.02; 0.024 ; 0.047; 0.090; 0.12;]/100; Compounding = 1; Basis = 1; RateSpec = intenvset('ValuationDate',ValuationDate,'StartDates',ValuationDate, ... 'EndDates',EndDates,'Rates',Rates,'Compounding',Compounding,'Basis',Basis)

`RateSpec = `*struct with fields:*
FinObj: 'RateSpec'
Compounding: 1
Disc: [5x1 double]
Rates: [5x1 double]
EndTimes: [5x1 double]
StartTimes: [5x1 double]
EndDates: [5x1 double]
StartDates: 736330
ValuationDate: 736330
Basis: 1
EndMonthRule: 1

Price the swaptions with using the Shifted Black model.

Settle = 'Jan-1-2016'; ExerciseDates = 'Jan-1-2017'; Maturities = {'Jan-1-2018';'Jan-1-2019';'Jan-1-2020'}; Strikes = [-0.0034;-0.0032;-0.003]; ShiftedBlackVolatilities = [0.33;0.32;0.31]; % A vector of volatilities. Principal = 1000; Reset = 1; OptSpec = 'call'; Shifts = [0.0085;0.0082;0.008]; % A vector of shifts. Prices = swaptionbyblk(RateSpec,OptSpec,Strikes,Settle,ExerciseDates, ... Maturities,ShiftedBlackVolatilities,'Basis',Basis,'Reset',Reset, ... 'Principal',Principal,'Shift',Shifts)

`Prices = `*3×1*
4.1117
8.0577
12.8301

## Input Arguments

`RateSpec`

— Interest-rate term structure

structure

Interest-rate term structure (annualized and continuously compounded),
specified by the `RateSpec`

obtained from `intenvset`

. For information on the interest-rate
specification, see `intenvset`

.

If the paying leg is different than the receiving leg, the `RateSpec`

can
be a `NINST`

-by-`2`

input variable
of `RateSpec`

s, with the second input being the discount
curve for the paying leg. If only one curve is specified, then it
is used to discount both legs.

**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.

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.

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.

**Data Types: **`char`

| `cell`

`Strike`

— Strike swap rate values

decimal

Strike swap rate values, specified as a `NINST`

-by-`1`

vector
of decimal values.

**Data Types: **`double`

`Settle`

— Settlement date

serial date number | date character vector | cell array of date character vectors

Settlement date (representing the settle date for each swaption),
specified as a `NINST`

-by-`1`

vector
of serial date numbers or date character vectors. `Settle`

must
not be later than `ExerciseDates`

.

The `Settle`

date input for `swaptionbyblk`

is
the valuation date on which the swaption (an option to enter into
a swap) is priced. The swaption buyer pays this price on this date
to hold the swaption.

**Data Types: **`double`

| `char`

`ExerciseDates`

— Dates on which swaption expires and underlying swap starts

serial date number | date character vector | cell array of date character vectors

Dates, specified as serial date numbers or date character vectors, on which the swaption expires and the underlying swap starts. The swaption holder can choose to enter into the swap on this date if the situation is favorable.

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.

**Data Types: **`double`

| `char`

| `cell`

`Maturity`

— Maturity date for each forward swap

serial date number | date character vector | cell array of date character vectors

Maturity date for each forward swap, specified as a `NINST`

-by-`1`

vector
of dates using serial date numbers or date character vectors.

**Data Types: **`double`

| `char`

| `cell`

`Volatility`

— Annual volatilities values

numeric

Annual volatilities values, specified as a
`NINST`

-by-`1`

vector of numeric values.

**Data Types: **`double`

### 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 = swaptionbyblk(OISCurve,OptSpec,Strike,Settle,ExerciseDate,Maturity,BlackVol,'Reset',1,'Shift',.5)`

`Basis`

— Day-count basis of instrument

`0`

(actual/actual) (default) | integer from `0`

to `13`

Day-count basis of the 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. Default is
`0`

(actual/actual).

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`

`Reset`

— Reset frequency per year for underlying forward swap

`1`

(default) | numeric

Reset frequency per year for the underlying forward swap, specified as the comma-separated
pair consisting of `'Reset'`

and a
`NINST`

-by-`1`

vector or
`NINST`

-by-`2`

matrix representing the reset
frequency per year for each leg. If `Reset`

is
`NINST`

-by-`2`

, the first column represents the
receiving leg, while the second column represents the paying leg.

**Data Types: **`double`

`ProjectionCurve`

— Rate curve used in generating future forward rates

if `ProjectionCurve`

is not
specified, then `RateSpec`

is used both for discounting
cash flows and projecting future forward rates (default) | structure

The rate curve to be used in generating the future forward rates, specified as the
comma-separated pair consisting of `'ProjectionCurve'`

and a
structure created using `intenvset`

. Use this optional input
if the forward curve is different from the discount curve.

**Data Types: **`struct`

`Shift`

— Shift in decimals for shifted Black model

`0`

(no shift) (default) | positive decimal

Shift in decimals for the shifted Black model, specified as the comma-separated pair
consisting of `'Shift'`

and a scalar or
`NINST`

-by-`1`

vector of rate shifts in positive
decimals. Set this parameter to a positive rate shift in decimals to add a positive
shift to the forward swap rate and strike, which effectively sets a negative lower
bound for the forward swap rate and strike. For example, a `Shift`

of
`0.01`

is equal to a 1% shift.

**Data Types: **`double`

## Output Arguments

`Price`

— Prices for swaptions at time 0

vector

Prices for the swaptions at time 0, returned as a `NINST`

-by-`1`

vector
of prices.

## More About

### Forward Swap

A *forward swap* is a
swap that starts at a future date.

### Shifted Black

The *Shifted Black* model
is essentially the same as the Black’s model, except that it
models the movements of (*F* + *Shift*)
as the underlying asset, instead of *F* (which is
the forward swap rate in the case of swaptions).

This model allows negative rates, with a fixed negative lower bound defined by the amount of shift; that is, the zero lower bound of Black’s model has been shifted.

## Algorithms

### Black Model

$$\begin{array}{l}dF={\sigma}_{Black}Fdw\\ call={e}^{-\gamma T}\left[FN({d}_{1})-KN({d}_{2})\right]\\ put={e}^{-\gamma T}\left[KN(-{d}_{2})-FN(-{d}_{1})\right]\\ {d}_{1}=\frac{\mathrm{ln}\left(\frac{F}{K}\right)+\left(\frac{{\sigma}_{B}{}^{2}}{2}\right)T}{{\sigma}_{B}\sqrt{T}},\text{}{d}_{2}={d}_{1}-{\sigma}_{B}\sqrt{T}\\ {\sigma}_{B}={\sigma}_{Black}\end{array}$$

Where *F* is the forward value and *K* is
the strike.

### Shifted Black Model

$$\begin{array}{l}dF={\sigma}_{Shifted\_Black}\left(F+Shift\right)dw\\ call={e}^{-\gamma T}\left[\left(F+Shift\right)N({d}_{s1})-\left(K+Shift\right)N({d}_{s2})\right]\\ put={e}^{-\gamma T}\left[\left(K+Shift\right)N(-{d}_{s2})-\left(F+Shift\right)N(-{d}_{s1})\right]\\ {d}_{s1}=\frac{\mathrm{ln}\left(\frac{F+Shift}{K+Shift}\right)+\left(\frac{{\sigma}_{sB}{}^{2}}{2}\right)T}{{\sigma}_{sB}\sqrt{T}},\text{}{d}_{s2}={d}_{s1}-{\sigma}_{sB}\sqrt{T}\\ {\sigma}_{sB}={\sigma}_{Shifted\_Black}\end{array}$$

Where *F*+*Shift* is the forward
value and *K*+*Shift* is the strike
for the shifted version.

## Version History

**Introduced before R2006a**

## See Also

`bondbyzero`

| `cfbyzero`

| `fixedbyzero`

| `floatbyzero`

| `blackvolbysabr`

| `intenvset`

| `swaptionbynormal`

| `capbyblk`

| `floorbyblk`

### Topics

- Calibrate the SABR Model
- Price a Swaption Using the SABR Model
- Price Swaptions with Negative Strikes Using the Shifted SABR Model
- Swaption
- Work with Negative Interest Rates Using Functions
- Supported Interest-Rate Instrument Functions
- Mapping Financial Instruments Toolbox Functions for Interest-Rate Instrument Objects

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## 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)