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



[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:


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


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"
    ExerciseStyle: "european"
     ExerciseDate: 15-Sep-2021
           Strike: 5
             Name: "spread_option"

Create BlackScholes Model Object

Use finmodel to create a BlackScholes model object.

BlackScholesModel = finmodel("BlackScholes",'Volatility',[.2;.1])
BlackScholesModel = 
  BlackScholes with properties:

     Volatility: [2x1 double]
    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: [2x1 double]
    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: []

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

Input Arguments

collapse all

Pricer object (previously created using finpricer), specified as a scalar. The supported pricer objects are: BjerksundStensland, Black, BlackScholes, CDSBlack, ConzeViswanathan, GoldmanSosinGatto, HullWhite, KemnaVorst, Kirk, Levy, Normal, RollGeskeWhaley, SABR, or TurnbullWakeman

Data Types: object

Instrument object (previously created using fininstrument), specified as a scalar. The supported instrument objects are: Cap, Floor, Swaption, Vanilla, Lookback, Barrier, Asian, Spread, or CDSOption.

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'}

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


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, or SABR pricing method.

Introduced in R2020a