Main Content

VarianceSwap

VarianceSwap instrument object

Since R2020b

Description

Create and price a VarianceSwap instrument object for one or more Variance Swap instruments using this workflow:

  1. Use fininstrument to create a VarianceSwap instrument object for one or more Variance Swap instruments.

  2. Use ratecurve to specify a curve model or use finmodel to specify a Heston model.

  3. Choose a pricing method.

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 models and pricing methods for a VarianceSwap instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

VarianceSwapInstrument = fininstrument(InstrumentType,'Maturity',maturity_date,'Notional',notional_value) creates a VarianceSwap object for one or more Variance Swap instruments by specifying InstrumentType and sets properties using the required name-value pair arguments Maturity and Notional.

The VarianceSwap instrument supports the ReplicatingVarianceSwap and Heston pricing methods. For more information on the VarianceSwap instrument, see More About.

example

VarianceSwapInstrument = fininstrument(___,Name,Value) sets optional properties using additional name-value pair arguments in addition to the required arguments in the previous syntax. For example, VarianceSwapInstrument = fininstrument("VarianceSwap",'Maturity',datetime(2019,1,30),'Notional',100,'StartDate',datetime(2016,1,30),'RealizedVariance',0.02,'Strike',110,'Name',"varianceswap_instrument") creates a VarianceSwap option with a maturity date of January 30, 2019. You can specify multiple name-value pair arguments.

example

Input Arguments

expand all

Instrument type, specified as a string with the value of "VarianceSwap", a character vector with the value of 'VarianceSwap', an NINST-by-1 string array with values of "VarianceSwap", or an NINST-by-1 cell array of character vectors with values of 'VarianceSwap'.

Data Types: char | cell | string

Name-Value Arguments

Specify required and 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: VarianceSwapInstrument = fininstrument("VarianceSwap",'Maturity',datetime(2019,1,30),'Notional',100,'StartDate',datetime(2016,1,30),'RealizedVariance',0.02,'Strike',110,'Name',"varianceswap_instrument")

Required VarianceSwap Name-Value Pair Arguments

expand all

Variance swap maturity date, specified as the comma-separated pair consisting of 'Maturity' and a scalar or an NINST-by-1 vector.

If you use date character vectors or strings, the format must be recognizable by datetime because the Maturity property is stored as a datetime.

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

Notional amount, specified as the comma-separated pair consisting of 'Notional' and a scalar numeric or an NINST-by-1 numeric vector.

Data Types: double

Optional VarianceSwap Name-Value Pair Arguments

expand all

Start date, specified as the comma-separated pair consisting of 'StartDate' and a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

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

If you use date character vectors or strings, the format must be recognizable by datetime because the ExerciseDate property is stored as a datetime.

Realized variance, specified as the comma-separated pair consisting of 'RealizedVariance' and a scalar decimal or an NINST-by-1 vector of decimals.

Data Types: double

Strike variance, specified as the comma-separated pair consisting of 'Strike' and a scalar decimal or an NINST-by-1 vector of decimals.

Data Types: double

User-defined name for one of more instruments, specified as the comma-separated pair consisting of 'Name' and a scalar string or character vector or an NINST-by-1 cell array of character vectors or string array.

Data Types: char | cell | string

Properties

expand all

Maturity date, returned as a scalar datetime or an NINST-by-1 vector of datetimes.

Data Types: datetime

Notional amount, returned as a scalar numeric or an NINST-by-1 numeric vector.

Data Types: double

Start date, returned as a scalar datetime or an NINST-by-1 vector of datetimes.

Data Types: datetime

Realized variance, returned as a scalar decimal or an NINST-by-1 decimal vector.

Data Types: double

Strike variance, returned as a scalar decimal or an NINST-by-1 decimal vector.

Data Types: double

User-defined name for the instrument, returned as a scalar string or an NINST-by-1 string array.

Data Types: string

Object Functions

Examples

collapse all

This example shows the workflow to price a VarianceSwap instrument when you use a Heston model and a Heston pricing method.

Create VarianceSwap Instrument Object

Use fininstrument to create a VarianceSwap instrument object.

VarianceSwapInst = fininstrument("VarianceSwap",'Maturity',datetime(2020,9,15),'Notional',100,'StartDate',datetime(2020,6,15),'RealizedVariance',0.02,'Strike',0.05,'Name',"variance_swap_instrument")
VarianceSwapInst = 
  VarianceSwap with properties:

            Notional: 100
    RealizedVariance: 0.0200
              Strike: 0.0500
           StartDate: 15-Jun-2020
            Maturity: 15-Sep-2020
                Name: "variance_swap_instrument"

Create Heston Model Object

Use finmodel to create a Heston model object.

HestonModel = finmodel("Heston",'V0',0.06,'ThetaV',0.1,'Kappa',0.9,'SigmaV',0.7,'RhoSV',-.3)
HestonModel = 
  Heston with properties:

        V0: 0.0600
    ThetaV: 0.1000
     Kappa: 0.9000
    SigmaV: 0.7000
     RhoSV: -0.3000

Create ratecurve Object

Create a flat ratecurve object using ratecurve.

Settle = datetime(2020, 1, 1);
ZeroTimes = calmonths(3);
ZeroRates = 0.05;
ZeroDates = Settle + ZeroTimes;
Basis = 1;
ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates,'Basis',Basis)
ZeroCurve = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: -1
                Basis: 1
                Dates: 01-Apr-2020
                Rates: 0.0500
               Settle: 01-Jan-2020
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create Heston Pricer Object

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

outPricer = finpricer("Analytic",'DiscountCurve',ZeroCurve,'Model',HestonModel)
outPricer = 
  Heston with properties:

    DiscountCurve: [1x1 ratecurve]
            Model: [1x1 finmodel.Heston]

Price VarianceSwap Instrument

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

[Price, outPR] = price(outPricer,VarianceSwapInst,["all"])
Price = 
10.8321
outPR = 
  priceresult with properties:

       Results: [1x2 table]
    PricerData: []

outPR.Results
ans=1×2 table
    Price     FairVariance
    ______    ____________

    10.832      0.07039   

This example shows the workflow to price multiple VarianceSwap instrument when you use a Heston model and a Heston pricing method.

Create VarianceSwap Instrument Object

Use fininstrument to create a VarianceSwap instrument object for three Variance Swap instruments.

VarianceSwapInst = fininstrument("VarianceSwap",'Maturity',datetime([2020,9,15 ; 2020,9,15 ; 2020,9,15]),'Notional',100,'StartDate',datetime(2020,6,15),'RealizedVariance',0.02,'Strike',0.05,'Name',"variance_swap_instrument")
VarianceSwapInst=3×1 VarianceSwap array with properties:
    Notional
    RealizedVariance
    Strike
    StartDate
    Maturity
    Name

Create Heston Model Object

Use finmodel to create a Heston model object.

HestonModel = finmodel("Heston",'V0',0.06,'ThetaV',0.1,'Kappa',0.9,'SigmaV',0.7,'RhoSV',-.3)
HestonModel = 
  Heston with properties:

        V0: 0.0600
    ThetaV: 0.1000
     Kappa: 0.9000
    SigmaV: 0.7000
     RhoSV: -0.3000

Create ratecurve Object

Create a flat ratecurve object using ratecurve.

Settle = datetime(2020, 1, 1);
ZeroTimes = calmonths(3);
ZeroRates = 0.05;
ZeroDates = Settle + ZeroTimes;
Basis = 1;
ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates,'Basis',Basis)
ZeroCurve = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: -1
                Basis: 1
                Dates: 01-Apr-2020
                Rates: 0.0500
               Settle: 01-Jan-2020
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create Heston Pricer Object

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

outPricer = finpricer("Analytic",'DiscountCurve',ZeroCurve,'Model',HestonModel)
outPricer = 
  Heston with properties:

    DiscountCurve: [1x1 ratecurve]
            Model: [1x1 finmodel.Heston]

Price VarianceSwap Instruments

Use price to compute the prices and fair variance for the three VarianceSwap instruments.

% [Price, outPR] = price(outPricer,VarianceSwapInst,["all"])
% outPR.Results

This example shows the workflow to price a VarianceSwap instrument when you use a ratecurve object 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   

More About

expand all

Version History

Introduced in R2020b

expand all