# swaptionbylg2f

Price European swaption using Linear Gaussian two-factor model

## Syntax

``Price = swaptionbylg2f(ZeroCurve,a,b,sigma,eta,rho,Strike,ExerciseDate,Maturity)``
``Price = swaptionbylg2f(___,Name,Value)``

## Description

example

````Price = swaptionbylg2f(ZeroCurve,a,b,sigma,eta,rho,Strike,ExerciseDate,Maturity)` returns the European swaption price for a two-factor additive Gaussian interest-rate model. NoteAlternatively, 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 = swaptionbylg2f(___,Name,Value)` adds optional name-value pair arguments.```

## Examples

collapse all

Define the `ZeroCurve`, `a`, `b`, `sigma`, `eta`, and `rho` parameters to compute the price of the swaption.

```Settle = datetime(2007,12,15); ZeroTimes = [3/12 6/12 1 5 7 10 20 30]'; ZeroRates = [0.033 0.034 0.035 0.040 0.042 0.044 0.048 0.0475]'; CurveDates = daysadd(Settle,360*ZeroTimes,1); irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates); a = .07; b = .5; sigma = .01; eta = .006; rho = -.7; Reset = 1; ExerciseDate = daysadd(Settle,360*5,1); Maturity = daysadd(ExerciseDate,360*[3;4],1); Strike = .05; Price = swaptionbylg2f(irdc,a,b,sigma,eta,rho,Strike,ExerciseDate,Maturity,'Reset',Reset)```
```Price = 2×1 1.1869 1.5590 ```

## Input Arguments

collapse all

Zero-curve for the Linear Gaussian two-factor model, specified using `IRDataCurve` or `RateSpec`.

Data Types: `struct`

Mean reversion for first factor for the Linear Gaussian two-factor model, specified as a scalar.

Data Types: `single` | `double`

Mean reversion for second factor for the Linear Gaussian two-factor model, specified as a scalar.

Data Types: `single` | `double`

Volatility for first factor for the Linear Gaussian two-factor model, specified as a scalar.

Data Types: `single` | `double`

Volatility for second factor for the Linear Gaussian two-factor model, specified as a scalar.

Data Types: `single` | `double`

Scalar correlation of the factors, specified as a scalar.

Data Types: `single` | `double`

Swaption strike price, specified as a nonnegative integer using a `NumSwaptions`-by-`1` vector.

Data Types: `single` | `double`

Swaption exercise dates, specified as a `NumSwaptions`-by-`1` vector using a datetime array, string array, or date character vectors.

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

Underlying swap maturity date, specified using a `NumSwaptions`-by-`1` vector using a datetime array, string array, or date character vectors.

To support existing code, `swaptionbylg2f` 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 = swaptionbylg2f(irdc,a,b,sigma,eta,rho,Strike,ExerciseDate,Maturity,'Reset',1,'Notional',100,'OptSpec','call')```

Frequency of swaption payments per year, specified as the comma-separated pair consisting of `'Reset'` and positive integers for the values `1,2,4,6,12` in a `NumSwaptions`-by-`1` vector.

Data Types: `single` | `double`

Notional value of swaption, specified as the comma-separated pair consisting of `'Notional'` and a nonnegative integer using a `NumSwaptions`-by-`1` vector of notional amounts.

Data Types: `single` | `double`

Option specification for the swaption, specified as the comma-separated pair consisting of `'OptSpec'` and a character vector or a `NumSwaptions`-by-`1` cell array of character vectors with a value of `'call'` or `'put'`.

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`

## Output Arguments

collapse all

Swaption price, returned as a scalar or an `NumSwaptions`-by-`1` vector.

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.

## Algorithms

The following defines the swaption price for a two-factor additive Gaussian interest-rate model, given the `ZeroCurve`, `a`, `b`, `sigma`, `eta`, and `rho` parameters:

`$r\left(t\right)=x\left(t\right)+y\left(t\right)+\varphi \left(t\right)$`

where $d{W}_{1}\left(t\right)d{W}_{2}\left(t\right)=\rho dt$ is a two-dimensional Brownian motion with correlation ρ and ϕ is a function chosen to match the initial zero curve.

## References

[1] Brigo, D. and F. Mercurio. Interest Rate Models - Theory and Practice. Springer Finance, 2006.

## Version History

Introduced in R2013a

expand all