Main Content

price

Compute price for interest-rate, equity, or credit derivative instrument with Analytic 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.

The Analytic pricer supports the following pricer objects:

example

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

Examples

collapse all

This example shows the workflow to price a European exercise Spread instrument when you use a BlackScholes model and a BjerksundStensland pricing method.

Create Spread Instrument Object

Use fininstrument to create a Spread instrument object.

SpreadOpt = fininstrument("Spread",'Strike',5,'ExerciseDate',datetime(2021,9,15),'OptionType',"put",'ExerciseStyle',"european",'Name',"spread_option")
SpreadOpt = 
  Spread with properties:

       OptionType: "put"
           Strike: 5
    ExerciseStyle: "european"
     ExerciseDate: 15-Sep-2021
             Name: "spread_option"

Create BlackScholes Model Object

Use finmodel to create a BlackScholes model object.

BlackScholesModel = finmodel("BlackScholes",'Volatility',[0.2,0.1])
BlackScholesModel = 
  BlackScholes with properties:

     Volatility: [0.2000 0.1000]
    Correlation: [2x2 double]

Create ratecurve Object

Create a flat ratecurve object using ratecurve.

Settle = datetime(2018,9,15);
Maturity = datetime(2023,9,15);
Rate = 0.035;
myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: -1
                Basis: 12
                Dates: 15-Sep-2023
                Rates: 0.0350
               Settle: 15-Sep-2018
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create BjerksundStensland Pricer Object

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

outPricer = finpricer("analytic",'Model',BlackScholesModel,'DiscountCurve',myRC,'SpotPrice',[100,105],'DividendValue',[0.09,0.17],'PricingMethod',"BjerksundStensland")
outPricer = 
  BjerksundStensland with properties:

    DiscountCurve: [1x1 ratecurve]
            Model: [1x1 finmodel.BlackScholes]
        SpotPrice: [100 105]
    DividendValue: [0.0900 0.1700]
     DividendType: "continuous"

Price Spread Instrument

Use price to compute the price and sensitivities for the Spread instrument.

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

       Results: [1x7 table]
    PricerData: []

outPR.Results
ans=1×7 table
    Price            Delta                    Gamma                   Lambda                Vega          Theta       Rho  
    ______    ____________________    ______________________    __________________    ________________    ______    _______

    7.0596    -0.23249     0.27057    0.0069887    0.0055319    -3.2932     3.8327    41.938    18.303    1.1011    -5.6943

This example shows the workflow to price the absolute return for three Cliquet instruments when you use a BlackScholes model and a Rubinstein pricing method.

Create ratecurve Object

Create a flat ratecurve object using ratecurve.

Settle = datetime(2018,9,15);
Maturity = datetime(2023,9,15);
Rate = 0.035;
myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: -1
                Basis: 12
                Dates: 15-Sep-2023
                Rates: 0.0350
               Settle: 15-Sep-2018
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create Cliquet Instrument Object

Use fininstrument to create a Cliquet instrument object for three Cliquet instruments.

ResetDates = Settle + years(0:0.25:1);  
CliquetOpt = fininstrument("Cliquet",'ResetDates',ResetDates,'InitialStrike',[140;150;160],'ExerciseStyle',"european",'Name',"cliquet_option")
CliquetOpt=3×1 object
  3x1 Cliquet array with properties:

    OptionType
    ExerciseStyle
    ResetDates
    LocalCap
    LocalFloor
    GlobalCap
    GlobalFloor
    ReturnType
    InitialStrike
    Name

Create BlackScholes Model Object

Use finmodel to create a BlackScholes model object.

BlackScholesModel = finmodel("BlackScholes",'Volatility',0.28)
BlackScholesModel = 
  BlackScholes with properties:

     Volatility: 0.2800
    Correlation: 1

Create Rubinstein Pricer Object

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

outPricer = finpricer("analytic",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',135,'DividendValue',0.025,'PricingMethod',"Rubinstein")
outPricer = 
  Rubinstein with properties:

    DiscountCurve: [1x1 ratecurve]
            Model: [1x1 finmodel.BlackScholes]
        SpotPrice: 135
    DividendValue: 0.0250
     DividendType: "continuous"

Price Cliquet Instruments

Use price to compute the price and sensitivities for the three Cliquet instruments.

[Price, outPR] = price(outPricer,CliquetOpt,"all")
Price = 3×1

   28.1905
   25.3226
   23.8168

outPR=3×1 object
  3x1 priceresult array with properties:

    Results
    PricerData

outPR.Results 
ans=1×7 table
    Price      Delta      Gamma     Lambda     Vega      Rho      Theta 
    ______    _______    _______    ______    ______    ______    ______

    28.191    0.59697    0.02066    2.8588    105.38    60.643    -14.62

ans=1×7 table
    Price      Delta      Gamma      Lambda     Vega      Rho       Theta 
    ______    _______    ________    ______    ______    ______    _______

    25.323    0.41949    0.016816    2.2364    100.47    55.367    -11.708

ans=1×7 table
    Price      Delta      Gamma      Lambda     Vega      Rho      Theta 
    ______    _______    ________    ______    ______    ______    ______

    23.817    0.29729    0.011132    1.6851    93.219    51.616    -7.511

Input Arguments

collapse all

Instrument object (previously created using fininstrument), specified as a scalar or a vector.

The supported instrument objects using a scalar or vector are:

The supported instrument object using a scalar is:

Data Types: object

(Optional) List of sensitivities to compute, specified as a NOUT-by-1 or a 1-by-NOUT cell array of character vectors or string array.

The supported sensitivities depend on the pricing method.

inpPricer ObjectSupported Sensitivities
BjerksundStensland{'delta','gamma','vega', 'theta','rho','price','lambda'}
IkedaKunitomo{'delta','gamma','vega','theta','rho','price','lambda'}
Black'price'
BlackScholes{'delta','gamma','vega','theta','rho','price','lambda'}
CDSBlack'price'
ConzeViswanathan{'delta','gamma','vega','theta','rho','price','lambda}'
GoldmanSosinGatto{'delta','gamma','vega','theta','rho','price','lambda}'
HeynenKat{'delta','gamma','vega','theta','rho','price','lambda}'
HullWhite'price'
Heston'price'
KemnaVorst{'delta','gamma','vega','theta','rho','price','lambda'}
Kirk{'delta','gamma','vega','theta','rho','price','lambda'}
Levy{'delta','gamma','vega','theta','rho','price','lambda'}
Normal'price'
RollGeskeWhaley{'delta','gamma','vega','theta','rho','price','lambda'}
Rubinstein{'delta','gamma','vega','theta','rho','price','lambda'}
SABR'price'
TurnbullWakeman{'delta','gamma','vega','theta','rho','price',}

inpSensitivity = {'All'} or inpSensitivity = ["All"] specifies that all sensitivities for the pricing method are returned. This is the same as specifying inpSensitivity to include each sensitivity.

Example: inpSensitivity = ["delta","gamma","vega","lambda","rho","theta","price"]

Data Types: cell | string

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 sensitivities (if you specify inpSensitivity)

  • PriceResult.PricerData — Structure for pricer data

    Note

    When pricing a VarianceSwap, PriceResult.FairVariance is returned.

Note

The inpPricer options that do not support sensitivities do not return a PriceResult. For example, there is no PriceResult returned for when using a Black, CDSBlack, HullWhite, Normal, Heston, or SABR pricing method.

Introduced in R2020a