Main Content

price

Compute price for equity instrument with AssetTree pricer

Description

example

[Price,PriceResult] = price(inpPricer,inpInstrument) computes the equity 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 in addition to the required arguments in the previous syntax.

Examples

collapse all

This example shows the workflow to price a Vanilla instrument when you use a BlackScholes model and an AssetTree pricing method.

Create Vanilla Instrument Object

Use fininstrument to create a Vanilla instrument object.

VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2019,5,1),'Strike',29,'OptionType',"put",'ExerciseStyle',"european",'Name',"vanilla_option")
VanillaOpt = 
  Vanilla with properties:

       OptionType: "put"
    ExerciseStyle: "european"
     ExerciseDate: 01-May-2019
           Strike: 29
             Name: "vanilla_option"

Create BlackScholes Model Object

Use finmodel to create a BlackScholes model object.

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

     Volatility: 0.2500
    Correlation: 1

Create ratecurve Object

Create a flat ratecurve object using ratecurve.

Settle = datetime(2018,1,1);
Maturity = datetime(2020,1,1);
Rate = 0.035;
myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',1)
myRC = 
  ratecurve with properties:

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

Create AssetTree Pricer Object

Use finpricer to create an AssetTree pricer object for an LR equity tree and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

LRPricer = finpricer("AssetTree",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',30,'PricingMethod',"LeisenReimer",'Maturity',datetime(2019,5,1),'NumPeriods',15)
LRPricer = 
  LRTree with properties:

    InversionMethod: PP1
             Strike: 30
               Tree: [1x1 struct]
         NumPeriods: 15
              Model: [1x1 finmodel.BlackScholes]
      DiscountCurve: [1x1 ratecurve]
          SpotPrice: 30
       DividendType: "continuous"
      DividendValue: 0
          TreeDates: [1x15 datetime]

Price Vanilla Instrument

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

[Price, outPR] = price(LRPricer,VanillaOpt,"all")
Price = 2.2542
outPR = 
  priceresult with properties:

       Results: [1x7 table]
    PricerData: [1x1 struct]

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

    2.2542    -0.33628    0.044039    12.724    -4.469    -16.433    -0.76073

Input Arguments

collapse all

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

Data Types: object

Instrument object, specified as a scalar or vector of previously created instrument objects. Create the instrument objects using fininstrument. The following instrument objects are supported:

Data Types: object

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

inpSensitivity = {'All'} or inpSensitivity = ["All"] specifies that the output is 'Delta', 'Gamma', 'Vega', 'Theta', 'Rho', 'Lambda', and 'Price'. Using this syntax is the same as specifying inpSensitivity to include each sensitivity.

inpInstrumentSupported Sensitivities
Asian{'delta','gamma','vega','theta','rho','lambda','price'}
Barrier{'delta','gamma','vega','theta','rho','lambda','price'}
Lookback{'delta','gamma','vega','theta','rho','lambda','price'}
Vanilla{'delta','gamma','vega','theta','rho','lambda','price'}

Note

Sensitivities are calculated based on yield shifts of 1 basis point, where the ShiftValue = 1/10000. All sensitivities are returned as dollar sensitivities. To find the per-dollar sensitivities, divide the sensitivities by their respective instrument price.

Example: inpSensitivity = {'delta','gamma','vega','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 sensitivities (if you specify inpSensitivity)

  • PriceResult.PricerData — Structure for pricer data that depends on the instrument that is being priced

    Asian and Lookback have an empty ([]) PricerData field because the pricing functions for these instruments cannot unambiguously assign a price to any node but the root node.

    Vanilla and Barrier have the following shared fields for PriceResult.PricerData.PriceTree:

    • PTree contains the clean prices.

    • ExTree contains the exercise indicator arrays. Each element of the cell array is an array where 1 indicates that an option is exercised and 0 indicates that an option is not exercised.

    • dObs contains the date of each level of the tree.

    • tObs contains the observation times.

    • Probs contains the probability arrays. Each element of the cell array contains the up, middle, and down transition probabilities for each node of the level.

Introduced in R2021a