Main Content

price

Compute price for equity instrument with ReplicatingVarianceSwap pricer

Description

example

[Price,PriceResult] = price(inpPricer,inpInstrument) computes the instrument price and related pricing information based on the pricing object inpPricer and the instrument object inpInstrument.

example

[Price,PriceResult] = price(___,inpSensitivity) adds an optional argument to specify sensitivities.

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  
      ⋮

Input Arguments

collapse all

Pricer object, specified as a scalar ReplicatingVarianceSwap pricer object. Use finpricer to create the ReplicatingVarianceSwap pricer object.

Data Types: object

Instrument object, specified as a VarianceSwap instrument object. Use fininstrument to create the VarianceSwap instrument object.

Data Types: object

(Optional) List of sensitivities to compute, specified as an NOUT-by-1 or 1-by-NOUT cell array of character vectors or string array with possible values of 'Price' and 'All'.

inpSensitivity = {'All'} or inpSensitivity = ["All"] specifies that the output is Price. This is the same as specifying inpSensitivity to include each sensitivity.

Example: inpSensitivity = {'price'}

Data Types: string | cell

Output Arguments

collapse all

Instrument price, returned as a numeric.

Price result, returned as a PriceResult object. The object has the following fields:

  • PriceResult.Results — Table of results that includes:

    • Price — Numeric scalar swap price value

    • FairVariance — Numeric fair variance in decimals

  • PriceResult.PricerData.ReplicatingPortfolio — Table containing pricer data

Introduced in R2020b