# Dupire

Create `Dupire` model object for local volatility for `Vanilla` instrument

## Description

Create and price a `Vanilla` instrument object with a `Dupire` model using this workflow:

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

2. Use `finmodel` to specify a `Dupire` model object for the `Vanilla` instrument.

3. Use `finpricer` to specify a `FiniteDifference` pricing method 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

``DupireObj = finmodel(ModelType,'ImpliedVolData',impliedvoldata_value)``

### Description

example

````DupireObj = finmodel(ModelType,'ImpliedVolData',impliedvoldata_value)` creates a `Dupire` model object by specifying `ModelType` and the required name-value pair argument `ImpliedVolData` to set properties using name-value pair arguments. For example, ```DupireObj = finmodel("Dupire",'ImpliedVolData',voldata_table)``` creates a `Dupire` model object.```

### Input Arguments

expand all

Model type, specified as the string with the value `"Dupire"` or the character vector with the value `'Dupire'`.

Data Types: `char` | `string`

`Dupire` Name-Value Pair Arguments

Specify required 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: ```DupireObj = finmodel("Dupire",'ImpliedVolData',voldata_table)```

Table of maturity dates, strike or exercise prices, and their corresponding implied volatilities, specified as the comma-separated pair consisting of `'ImpliedVolData'` and an `NVOL`-by-`3` table.

Data Types: `table`

## Properties

expand all

Table of maturity dates, strike or exercise prices, and corresponding implied volatilities, returned as an `NVOL`-by-`3` table.

Data Types: `table`

## Examples

collapse all

This example shows the workflow to price a V`anilla` instrument when you use a `Dupire` model and a `FiniteDifference` pricing method.

Create `Vanilla` Instrument Object

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

`VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2020,1,1),'Strike',105,'ExerciseStyle',"american",'Name',"vanilla_option")`
```VanillaOpt = Vanilla with properties: OptionType: "call" ExerciseStyle: "american" ExerciseDate: 01-Jan-2020 Strike: 105 Name: "vanilla_option" ```

Create `Dupire` Model Object

Define the implied volatility surface data.

```AssetPrice = 590; Maturity = ["06-Mar-2018" "05-Jun-2018" "12-Sep-2018" "10-Dec-2018" "01-Jan-2019" ... "02-Jul-2019" "01-Jan-2020" "01-Jan-2021" "01-Jan-2022" "01-Jan-2023"]; Maturity = repmat(Maturity,10,1); Maturity = Maturity(:); ExercisePrice = AssetPrice.*[0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.30 1.40]; ExercisePrice = repmat(ExercisePrice,1,10)'; ImpliedVol = [... 0.190; 0.168; 0.133; 0.113; 0.102; 0.097; 0.120; 0.142; 0.169; 0.200; ... 0.177; 0.155; 0.138; 0.125; 0.109; 0.103; 0.100; 0.114; 0.130; 0.150; ... 0.172; 0.157; 0.144; 0.133; 0.118; 0.104; 0.100; 0.101; 0.108; 0.124; ... 0.171; 0.159; 0.149; 0.137; 0.127; 0.113; 0.106; 0.103; 0.100; 0.110; ... 0.171; 0.159; 0.150; 0.138; 0.128; 0.115; 0.107; 0.103; 0.099; 0.108; ... 0.169; 0.160; 0.151; 0.142; 0.133; 0.124; 0.119; 0.113; 0.107; 0.102; ... 0.169; 0.161; 0.153; 0.145; 0.137; 0.130; 0.126; 0.119; 0.115; 0.111; ... 0.168; 0.161; 0.155; 0.149; 0.143; 0.137; 0.133; 0.128; 0.124; 0.123; ... 0.168; 0.162; 0.157; 0.152; 0.148; 0.143; 0.139; 0.135; 0.130; 0.128; ... 0.168; 0.164; 0.159; 0.154; 0.151; 0.147; 0.144; 0.140; 0.136; 0.132]; ImpliedVolData = table(Maturity, ExercisePrice, ImpliedVol);```

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

`DupireModel = finmodel("Dupire",'ImpliedVolData',ImpliedVolData)`
```DupireModel = Dupire with properties: ImpliedVolData: [100x3 table] ```

Create `ratecurve` Object

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

```Settle = datetime(2018,1,1); Maturity = datetime(2020,9,1); Rate = 0.06; myRC = ratecurve('zero',Settle,Maturity,Rate)```
```myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: 01-Sep-2020 Rates: 0.0600 Settle: 01-Jan-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous" ```

Create `FiniteDifference` Pricer Object

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

`outPricer = finpricer("FiniteDifference",'Model',DupireModel,'DiscountCurve',myRC,'SpotPrice',100,'DividendValue',0.0262,'DividendType',"continuous")`
```outPricer = FiniteDifference with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.Dupire] SpotPrice: 100 GridProperties: [1x1 struct] DividendType: "continuous" DividendValue: 0.0262 ```

Price `Vanilla` Instrument

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

`[Price, outPR] = price(outPricer,VanillaOpt,["all"])`
```Price = 15.5930 ```
```outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct] ```
`outPR.Results`
```ans=1×7 table Price Delta Gamma Lambda Theta Rho Vega ______ _______ _________ ______ _______ ______ _____ 15.593 0.55004 0.0091484 3.5275 -3.3431 78.792 49.33 ```

expand all

## References

[1] Andersen, L. B., and R. Brotherton-Ratcliffe. "The Equity Option Volatility Smile: An Implicit Finite-Difference Approach." Journal of Computational Finance. Vol. 1, Number 2, 1997, pp. 5–37.

[2] Dupire, B. "Pricing with a Smile." Risk. Vol. 7, Number 1, 1994, pp. 18–20.