Main Content


Create Heston pricer object for VarianceSwap instrument using Heston model

Since R2020b


Create and price a VarianceSwap instrument object with a Heston model and a Heston pricing method using this workflow:

  1. Use fininstrument to create a VarianceSwap instrument object.

  2. Use finmodel to specify the Heston model for the VarianceSwap instrument object.

  3. Use finpricer to specify the Heston pricer object for the VarianceSwap instrument object.

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




HestonPricerObj = finpricer(PricerType,'DiscountCurve',ratecurve_obj,'Model',model) creates a Heston pricer object by specifying PricerType and sets properties using the required name-value pair arguments DiscountCurve and Model. For example, HestonPricerObj = finpricer("Analytic",'DiscountCurve',ratecurve_obj,'Model',HWModel) creates a Heston pricer object.

Input Arguments

expand all

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

Data Types: char | string

Name-Value Arguments

Specify required 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: HestonPricerObj = finpricer("Analytic",'DiscountCurve',ratecurve_obj,'Model',HWModel)

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


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

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

Data Types: object


expand all

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

Data Types: object

Model, returned as a Heston model object.

Data Types: object

Object Functions

priceCompute price for interest-rate, equity, or credit derivative instrument with Analytic pricer


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.1,'Name',"variance_swap_instrument")
VarianceSwapInst = 
  VarianceSwap with properties:

            Notional: 100
    RealizedVariance: 0.0200
              Strike: 0.1000
           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 = 6.0054
outPR = 
  priceresult with properties:

       Results: [1x2 table]
    PricerData: []

ans=1×2 table
    Price     FairVariance
    ______    ____________

    6.0054      0.07039   


Variance swaps can be priced with the calibrated Heston model by using the following closed-form expression for the fair variance:



  • ν0 is the initial variance of the underlying asset at 𝑡 = 0 ν0 > 0.

  • θ is the long-term variance level θ > 0.

  • k is the mean reversion speed for the variance (k > 0).

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



  • 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.

Version History

Introduced in R2020b