# ReplicatingVarianceSwap

Create `ReplicatingVarianceSwap` pricer object for `VarianceSwap` instrument using `ratecurve` object

## Description

Create and price a `VarianceSwap` instrument object with a `ratecurve` object and a `ReplicatingVarianceSwap` pricing method using this workflow:

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

2. Use `ratecurve` to specify a curve model for the `VarianceSwap` instrument.

3. Use `finpricer` to specify a `ReplicatingVarianceSwap` pricer object for the `VarianceSwap` 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 `VarianceSwap` instrument, see Choose Instruments, Models, and Pricers.

## Creation

### Syntax

``ReplicatingVarianceSwapPricerObj = finpricer(PricerType,'DiscountCurve',ratecurve_obj,'VolatilitySmile',volatilitysmile_value,'SpotPrce',spotprice_value)``
``ReplicatingVarianceSwapPricerObj = finpricer(___,Name,Value)``

### Description

example

````ReplicatingVarianceSwapPricerObj = finpricer(PricerType,'DiscountCurve',ratecurve_obj,'VolatilitySmile',volatilitysmile_value,'SpotPrce',spotprice_value)` creates an `ReplicatingVarianceSwap` pricer object by specifying `PricerType` and sets properties using the required name-value pair arguments `DiscountCurve`, `VolatilitySmile`, and `SpotPrice`.```

example

````ReplicatingVarianceSwapPricerObj = finpricer(___,Name,Value)` sets optional properties using additional name-value pairs in addition to the required arguments in the previous syntax. For example, ```ReplicatingVarianceSwapPricerObj = finpricer("ReplicatingVarianceSwap",'DiscountCurve',ratecurve_obj,'VolatilitySmile',smiletable,'SpotPrice',1000,'CallPutBoundary',"forwardprice",'InterpMethod',"cubic")``` creates a `ReplicatingVarianceSwap` pricer object. You can specify multiple name-value pair arguments.```

### Input Arguments

expand all

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

Data Types: `char` | `string`

`ReplicatingVarianceSwap` 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: ```ReplicatingVarianceSwapPricerObj = finpricer("ReplicatingVarianceSwap",'DiscountCurve',ratecurve_obj,'VolatilitySmile',smiletable,'SpotPrice',1000,'CallPutBoundary',"forwardprice",'InterpMethod',"cubic")```
Required `ReplicatingVarianceSwap` Name-Value Pair Arguments

expand all

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.

• The software uses the `Basis` value of the specified `ratecurve` object to calculate both the discounting and accrual for the `VarianceSwap` instrument object.

Data Types: `object`

Volatility smile table, specified as the comma-separated pair consisting of `'VolatilitySmile'` and a table with the columns `"Strike"` and `"Volatility"` or a `NumVols`-by-`2` matrix where the first column is the strikes and the second column is the volatilities in decimals.

Data Types: `table` | `double`

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

Note

`SpotPrice` must be covered by the range of strikes in `VolatilitySmile`.

Data Types: `double`

Optional `ReplicatingVarianceSwap` Name-Value Pair Arguments

expand all

Boundary strike for call and put options, specified as the comma-separated pair consisting of `'CallPutBoundary'` and a scalar numeric or one of the following character vectors or strings:

• `"spotprice"` — The call and put option boundary strike is the spot price.

• `"forwardprice"` — The call and put option boundary strike is the forward price.

Note

`CallPutBoundary` must be covered by the range of strikes in `VolatilitySmile`.

Data Types: `double` | `char` | `string`

Interpolation method for `SmileTable`, specified as the comma-separated pair consisting of `'InterpMethod'` and a scalar string or character vector using a supported value. For more information on interpolation methods, see `interp1`.

Data Types: `char` | `string`

## Properties

expand all

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

Note

The software uses the `Basis` value of the specified `ratecurve` object to calculate both the discounting and accrual for the `VarianceSwap` instrument object.

Data Types: `object`

Volatility smile table, returned as a table with the columns `"Strike"` and `"Volatility"` or a `NumVols`-by-`2` matrix where the first column is the strikes and the second column is the volatilities in decimals.

Data Types: `table` | `double`

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

Data Types: `double`

Boundary strike for call and put options, returned as a numeric or as a string with the value `"spotprice"` or `"forwardprice"`.

Data Types: `double` | `char` | `string`

Interpolation method, returned as a scalar string.

Data Types: `string`

## Object Functions

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

## Examples

collapse all

This example shows the workflow to price a `VarianceSwap` instrument when you use a `ratecurve` and a `ReplicatingVarianceSwap` pricing method.

Create `VarianceSwap` Instrument Object

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

`VarianceSwapInst = fininstrument("VarianceSwap",'Maturity',datetime(2021,5,1),'Notional',150,'StartDate',datetime(2020,5,1),'RealizedVariance',0.05,'Strike',0.1,'Name',"variance_swap_instrument")`
```VarianceSwapInst = VarianceSwap with properties: Notional: 150 RealizedVariance: 0.0500 Strike: 0.1000 StartDate: 01-May-2020 Maturity: 01-May-2021 Name: "variance_swap_instrument" ```

Create `ratecurve` Object

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

```Settle = datetime(2020, 9, 15); ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]'; ZeroDates = Settle + ZeroTimes; Basis = 1; ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates,'Basis',Basis)```
```ZeroCurve = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 1 Dates: [10x1 datetime] Rates: [10x1 double] Settle: 15-Sep-2020 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous" ```

Create `ReplicatingVarianceSwap` Pricer Object

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

```Strike = (50:5:135)'; Volatility = [.49;.45;.42;.38;.34;.31;.28;.25;.23;.21;.2;.21;.21;.22;.23;.24;.25;.26]; VolatilitySmile = table(Strike, Volatility); SpotPrice = 100; CallPutBoundary = 100; outPricer = finpricer("ReplicatingVarianceSwap",'DiscountCurve', ZeroCurve, 'VolatilitySmile', VolatilitySmile, ... 'SpotPrice', SpotPrice, 'CallPutBoundary', CallPutBoundary)```
```outPricer = ReplicatingVarianceSwap with properties: DiscountCurve: [1x1 ratecurve] InterpMethod: "linear" VolatilitySmile: [18x2 table] SpotPrice: 100 CallPutBoundary: 100 ```

Price `VarianceSwap` Instrument

Use `price` to compute the price and fair variance for the `VarianceSwap` instrument.

`[Price, outPR] = price(outPricer,VarianceSwapInst,["all"])`
```Price = 8.1997 ```
```outPR = priceresult with properties: Results: [1x2 table] PricerData: [1x1 struct] ```
`outPR.Results`
```ans=1×2 table Price FairVariance ______ ____________ 8.1997 0.21701 ```
`outPR.PricerData.ReplicatingPortfolio`
```ans=19×6 table CallPut Strike Volatility Weight Value Contribution _______ ______ __________ __________ _______ ____________ "put" 50 0.49 0.0064038 0.39164 0.002508 "put" 55 0.45 0.0052877 0.49353 0.0026097 "put" 60 0.42 0.0044402 0.67329 0.0029895 "put" 65 0.38 0.0037814 0.80343 0.0030381 "put" 70 0.34 0.0032592 0.9419 0.0030698 "put" 75 0.31 0.0028382 1.223 0.0034711 "put" 80 0.28 0.0024938 1.58 0.0039403 "put" 85 0.25 0.0022086 2.0456 0.0045177 "put" 90 0.23 0.0019696 2.9221 0.0057554 "put" 95 0.21 0.0017675 4.1406 0.0073183 "put" 100 0.2 0.00082405 6.1408 0.0050603 "call" 100 0.2 0.00077087 6.4715 0.0049887 "call" 105 0.21 0.0014465 4.7094 0.0068119 "call" 110 0.21 0.0013178 3.1644 0.0041701 "call" 115 0.22 0.0012056 2.307 0.0027814 "call" 120 0.23 0.0011072 1.7127 0.0018962 ⋮ ```

expand all

## Algorithms

The fair value of the future variance Kvar is approximated in terms of the following portfolio of options ᴨCP:

`$\begin{array}{l}{K}_{\mathrm{var}}=\frac{2}{T}\left\{rT-\left(\frac{{S}_{0}}{{S}_{*}}{e}^{rT}-1\right)-\mathrm{log}\frac{{S}_{*}}{{S}_{0}}+{e}^{rT}{\pi }_{CP}\right\}\\ {\pi }_{CP}=\sum _{i}w\left({K}_{ip}\right)P\left(S,{K}_{ip}\right)+\sum _{i}w\left({K}_{ic}\right)C\left(S,{K}_{ic}\right)\end{array}$`

Here:

• Call option strikes — The call option strike are K0 < K1c < K2c < K3c … < Knc.

• Put option strikes — The put option strikes are Kmp < … < K3p < K2p < K1p < K0 = S*.

• Kvar — is the fair value of future variance

• CP — is the portfolio of call and put options

• S0 — is the current asset price

• S* — is the boundary between the call and put option strikes (for example, the spot price S0 or forward price S0erT)

• P(K) — is the current put option price with strike K

• C(K) — is the current call option price with strike K

If the options portfolio ᴨCP has an infinite number of options with continuously varying strikes, it has the following payoff function at maturity:

`$f\left({S}_{T}\right)=\frac{2}{T}\left[\frac{{S}_{T}-{S}_{*}}{{S}_{*}}-\mathrm{log}\frac{{S}_{T}}{{S}_{*}}\right]$`

Since it is not possible to construct such a portfolio with an infinite number of options and continuously varying strikes, the appropriate weights w(Kip) and w(Kic) for a portfolio with a finite number of options and discretely varying strikes can be computed by approximating the continuous payoff function f(ST) in a piecewise linear fashion. Starting with the strike at K0, the first call option weight can be computed as the slope of the first piecewise linear function:

`${w}_{c}\left({K}_{0}\right)=\frac{f\left({K}_{1c}\right)-f\left({K}_{0}\right)}{{K}_{1c}-{K}_{0}}$`

The next call option weight with the strike K1c is computed as the slope of the next piece-wise linear function minus the previous weight:

`${w}_{c}\left({K}_{1c}\right)=\frac{f\left({K}_{2c}\right)-f\left({K}_{1c}\right)}{{K}_{2c}-{K}_{1c}}-{w}_{c}\left({K}_{0}\right)$`

This procedure is continued for the remaining call option strikes:

`${w}_{c}\left({K}_{n,c}\right)=\frac{f\left({K}_{n+1,c}\right)-f\left({K}_{nc}\right)}{{K}_{n+1,c}-{K}_{n,c}}-\sum _{i=0}^{n-1}{w}_{c}\left({K}_{i,c}\right)$`

To compute the put option weights, a similar procedure can be used in the opposite direction (starting from K0):

`${w}_{p}\left({K}_{m,p}\right)=\frac{f\left({K}_{m+1,p}\right)-f\left({K}_{mp}\right)}{{K}_{m,p}-{K}_{m+1,p}}-\sum _{i=0}^{m-1}{w}_{p}\left({K}_{i,p}\right)$`

Once the fair variance is computed, the actual price paid in the market at time t for the variance swap with a StartDate at time 0 is computed as follows:

`$VarianceSwap\left(t\right)=Notional×Disc\left(t,T\right)×\left[\frac{t}{T}\mathrm{Re}alizedVariance\left(0,t\right)+\frac{T-t}{T}FairVariance\left(t,T\right)-StrikeVariance\right]$`

Here:

• t is the time from the start date of the variance swap to the settle date.

• T is the time from the start date to the maturity date of the variance swap.

• Disc(t,T) is the discount factor from settle to the maturity date.

• RealizedVariance(0,t) is the realized variance from start date to the settle date, in basis points.

• FairVariance(t,T) is the fair variance for the remaining life of the contract as of the settle date, in basis points.

• StrikeVariance is the strike variance predetermined at inception (start date), in basis points.

## References

[1] Demeterfi, K., Derman, E., Kamal, M., and J. Zou. “More Than You Ever Wanted To Know About Volatility Swaps.” Quantitative Strategies Research Notes. Goldman Sachs, 1999.