# NumericalIntegration

Create `NumericalIntegration` pricer object for `Vanilla` instrument using `Heston`, `Bates`, or `Merton` model

## Description

Create and price a `Vanilla` instrument object with a `Heston`, `Bates`, or `Merton` model and a `NumericalIntegration` pricing method using this workflow:

1. Use `fininstrument` to create a `Vanilla` instrument object.

2. Use `finmodel` to specify a `Heston`, `Bates`, or `Merton` model for the `Vanilla` instrument.

3. Use `finpricer` to specify a `NumericalIntegration` pricer object for the `Vanilla` instrument.

For more information on this workflow, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

For more information on the available pricing methods for a `Vanilla` instrument, see Choose Instruments, Models, and Pricers.

## Creation

### Syntax

``NumericalIntegrationPricerObj = finpricer(PricerType,'Model',model,'DiscountCurve',ratecurve_obj,'SpotPrice',spotprice_value)``
``NumericalIntegrationPricerObj = finpricer(___,Name,Value)``

### Description

example

````NumericalIntegrationPricerObj = finpricer(PricerType,'Model',model,'DiscountCurve',ratecurve_obj,'SpotPrice',spotprice_value)` creates a `NumericalIntegration` pricer object by specifying `PricerType` and sets the properties for the required name-value pair arguments `Model`, `DiscountCurve`, and `SpotPrice`.```

example

````NumericalIntegrationPricerObj = finpricer(___,Name,Value)` sets optional properties using additional name-value pairs in addition to the required arguments in the previous syntax. For example, ```NumericalIntegrationPricerObj = finpricer("NumericalIntegration",'Model',NIModel,'DiscountCurve',ratecurve_obj,'SpotPrice',1000,'DividendValue',100,'VolRiskPremium',0.9)``` creates a `NumericalIntegration` pricer object. You can specify multiple name-value pair arguments.```

### Input Arguments

expand all

Pricer type, specified as a string with the value of `"NumericalIntegration"` or a character vector with the value of `'NumericalIntegration'`.

Data Types: `char` | `string`

`NumericalIntegration` Name-Value Pair Arguments

Specify required and optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: ```NumericalIntegrationPricerObj = finpricer("NumericalIntegration",'Model',NIModel,'DiscountCurve',ratecurve_obj,'SpotPrice',1000,'DividendValue',100,'VolRiskPremium',0.9)```
Required `NumericalIntegration` Name-Value Pair Arguments

expand all

Model, specified as the comma-separated pair consisting of `'Model'` and the name of a previously created `Merton`, `Bates`, or `Heston` model object using `finmodel`.

Data Types: `object`

This property is read-only.

`ratecurve` object for discounting cash flows, specified as the comma-separated pair consisting of `'DiscountCurve'` and the name of a `ratecurve` object.

Note

Specify a flat `ratecurve` object for `DiscountCurve`. If you use a nonflat `ratecurve` object, the software uses the rate in the `ratecurve` object at `Maturity` and assumes that the value is constant for the life of the equity option.

Data Types: `object`

Current price of the underlying asset, specified as the comma-separated pair consisting of `'SpotPrice'` and a scalar nonnegative numeric.

Data Types: `double`

Optional `NumericalIntegration` Name-Value Pair Arguments

expand all

Dividend yield, specified as the comma-separated pair consisting of `'DividendValue'` and a scalar numeric.

Data Types: `double`

Volatility risk premium, specified as the comma-separated pair consisting of `'VolRiskPremium'` and a scalar numeric value.

Data Types: `double`

Flag indicating Little Heston Trap formulation by Albrecher et al., specified as the comma-separated pair consisting of `'LittleTrap'` and a logical:

Note

`LittleTrap` is supported only for `Heston` and `Bates` models.

Data Types: `logical`

Absolute error tolerance for numerical integration, specified as the comma-separated pair consisting of `'AbsTol'` and a scalar numeric value.

Data Types: `double`

Relative error tolerance for numerical integration, specified as the comma-separated pair consisting of `'RelTol'` and a scalar numeric value.

Data Types: `double`

Numerical integration range used to approximate the continuous integral over `[0 Inf]`, specified as the comma-separated pair consisting of `'IntegrationRange'` and a `1`-by-`2` vector representing `[LowerLimit UpperLimit]`.

Data Types: `double`

Framework for computing option prices and sensitivities using the numerical integration of models, specified as the comma-separated pair consisting of `'Framework'` and a scalar string or character vector with the following values:

• `"heston1993"` or `'heston1993'` — Method used in Heston (1993)

• `"lewis2001"` or `'lewis2001'` — Method used in Lewis (2001)

Data Types: `char` | `string`

## Properties

expand all

Model, returned as a model object.

Data Types: `object`

`ratecurve` object for discounting cash flows, returned as a `ratecurve` object.

Data Types: `object`

Current price of the underlying asset, returned as a scalar nonnegative numeric.

Data Types: `double`

Dividend yield, returned as a scalar numeric.

Data Types: `double`

Volatility risk premium, returned as a scalar numeric value.

Data Types: `double`

Flag indicating Little Heston Trap formulation by Albrecher et al., returned as a logical.

Data Types: `logical`

Absolute error tolerance for numerical integration, returned as a scalar numeric value.

Data Types: `double`

Relative error tolerance for numerical integration, returned as a scalar numeric value.

Data Types: `double`

Numerical integration range used to approximate the continuous integral over `[0 Inf]`, returned as a `1`-by-`2` vector representing `[LowerLimit UpperLimit]`.

Data Types: `double`

Framework for computing option prices and sensitivities using the numerical integration of models, returned as a scalar string.

Data Types: `string`

## Object Functions

 `price` Compute price for equity instrument with `NumericalIntegration` pricer

## Examples

collapse all

This example shows the workflow to price a `Vanilla` instrument when you use a `Merton` model and a `NumericalIntegration` pricing method.

Create `Vanilla` Instrument Object

Use `fininstrument` to create a `Vanilla` instrument object.

`VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2020,3,15),'ExerciseStyle',"european",'Strike',105,'Name',"vanilla_option")`
```VanillaOpt = Vanilla with properties: OptionType: "call" ExerciseStyle: "european" ExerciseDate: 15-Mar-2020 Strike: 105 Name: "vanilla_option" ```

Create `Merton` Model Object

Use `finmodel` to create a `Merton` model object.

`MertonModel = finmodel("Merton",'Volatility',0.45,'MeanJ',0.02,'JumpVol',0.07,'JumpFreq',0.09)`
```MertonModel = Merton with properties: Volatility: 0.4500 MeanJ: 0.0200 JumpVol: 0.0700 JumpFreq: 0.0900 ```

Create `ratecurve` Object

Create a flat `ratecurve` object using `ratecurve`.

`myRC = ratecurve('zero',datetime(2019,9,15),datetime(2020,3,15),0.02)`
```myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: 15-Mar-2020 Rates: 0.0200 Settle: 15-Sep-2019 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous" ```

Create `NumericalIntegration` Pricer Object

Use `finpricer` to create a `NumericalIntegration` pricer object and use the `ratecurve` object for the `'DiscountCurve'`name-value pair argument.

`outPricer = finpricer("numericalintegration",'Model',MertonModel,'DiscountCurve',myRC,'SpotPrice',100,'DividendValue',.01,'VolRiskPremium',0.9,'LittleTrap',false,'AbsTol',0.5,'RelTol',0.4,'Framework',"lewis2001")`
```outPricer = NumericalIntegration with properties: Model: [1x1 finmodel.Merton] DiscountCurve: [1x1 ratecurve] SpotPrice: 100 DividendType: "continuous" DividendValue: 0.0100 AbsTol: 0.5000 RelTol: 0.4000 IntegrationRange: [1.0000e-09 Inf] CharacteristicFcn: @characteristicFcnMerton76 Framework: "lewis2001" VolRiskPremium: 0.9000 LittleTrap: 0 ```

Price `Vanilla` Instrument

Use `price` to compute the price and sensitivities for the `Vanilla` instrument.

`[Price, outPR] = price(outPricer,VanillaOpt,["all"])`
```Price = 10.7325 ```
```outPR = priceresult with properties: Results: [1x6 table] PricerData: [] ```
`outPR.Results`
```ans=1×6 table Price Delta Gamma Theta Rho Vega ______ ______ ________ _______ ______ ______ 10.732 0.5058 0.012492 -12.969 19.815 27.954 ```

expand all

## References

[1] Albrecher, H., P. Mayer, W. Schoutens, and J. Tistaert. “The Little Heston Trap.” Working Paper, Linz and Graz University of Technology, K.U. Leuven, ING Financial Markets, 2006.