Quantcast

Documentation Center

  • Trial Software
  • Product Updates

spreadsensbyls

Calculate price and sensitivities for European or American spread options using Monte Carlo simulations

Syntax

  • PriceSens = spreadsensbyls(RateSpec,StockSpec1,StockSpec2,Settle,Maturity,
    OptSpec,Strike,Corr)
    example
  • PriceSens = spreadsensbyls(___,Name,Value)
  • [PriceSens,Paths,Times,Z] = spreadsensbyls(RateSpec,StockSpec1,StockSpec2,Settle,Maturity,
    OptSpec,Strike,Corr)
  • [PriceSens,Paths,Times,Z] = spreadsensbyls(___,Name,Value)

Description

example

PriceSens = spreadsensbyls(RateSpec,StockSpec1,StockSpec2,Settle,Maturity,
OptSpec,Strike,Corr)
returns the price of a European or American call or put spread option using Monte Carlo simulations.

PriceSens = spreadsensbyls(___,Name,Value) returns the price of a European or American call or put spread option using Monte Carlo simulations with optional name-value pair arguments.

[PriceSens,Paths,Times,Z] = spreadsensbyls(RateSpec,StockSpec1,StockSpec2,Settle,Maturity,
OptSpec,Strike,Corr)
returns the PriceSens, Paths, Times, and Z of a European or American call or put spread option using Monte Carlo simulations.

[PriceSens,Paths,Times,Z] = spreadsensbyls(___,Name,Value) returns the PriceSens, Paths, Times, and Z of a European or American call or put spread option using Monte Carlo simulations with optional name-value pair arguments.

Examples

expand all

Compute the Price and Sensitivities of a Spread Option Using Monte Carlo Simulation

Define the spread option dates.

Settle = '01-Jun-2012';
Maturity = '01-Sep-2012';

Define asset 1. Price and volatility of RBOB gasoline

  Price1gallon = 2.85;          % $/gallon
  Price1 = Price1gallon * 42;   % $/barrel
  Vol1 = 0.29;

Define asset 2. Price and volatility of WTI crude oil

  Price2 = 93.20;         % $/barrel
  Vol2 = 0.36;

Define the correlation between the underlying asset prices of asset 1 and asset 2.

Corr = 0.42;

Define the spread option.

OptSpec = 'call';
Strike = 20;

Define the RateSpec.

rates = 0.05;
Compounding = -1;
Basis = 1;
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, ...
'EndDates', Maturity, 'Rates', rates, ...
'Compounding', Compounding, 'Basis', Basis)
RateSpec = 

           FinObj: 'RateSpec'
      Compounding: -1
             Disc: 0.9876
            Rates: 0.0500
         EndTimes: 0.2500
       StartTimes: 0
         EndDates: 735113
       StartDates: 735021
    ValuationDate: 735021
            Basis: 1
     EndMonthRule: 1

Define the StockSpec for the two assets.

StockSpec1 = stockspec(Vol1, Price1)
StockSpec2 = stockspec(Vol2, Price2)
StockSpec1 = 

             FinObj: 'StockSpec'
              Sigma: 0.2900
         AssetPrice: 119.7000
       DividendType: []
    DividendAmounts: 0
    ExDividendDates: []


StockSpec2 = 

             FinObj: 'StockSpec'
              Sigma: 0.3600
         AssetPrice: 93.2000
       DividendType: []
    DividendAmounts: 0
    ExDividendDates: []

Compute the spread option price and sensitivities using Monte Carlo simulation based on the Longstaff-Schwartz model.

OutSpec = {'Price', 'Delta', 'Gamma'};
[Price, Delta, Gamma] = spreadsensbyls(RateSpec, StockSpec1, StockSpec2, ...
Settle, Maturity, OptSpec, Strike, Corr, 'OutSpec', OutSpec)
Price =

   11.0799


Delta =

    0.6626   -0.5972


Gamma =

    0.0209    0.0240

Input Arguments

expand all

RateSpec — Interest-rate term structurestructure

Interest-rate term structure (annualized and continuously compounded), specified by the RateSpec obtained from intenvset. For information on the interest-rate specification, see intenvset.

Data Types: struct

StockSpec1 — Stock specification for underlying asset 1structure

Stock specification for underlying asset 1. For information on the stock specification, see stockspec.

stockspec can handle other types of underlying assets. For example, for physical commodities the price is represented by StockSpec.Asset, the volatility is represented by StockSpec.Sigma, and the convenience yield is represented by StockSpec.DividendAmounts.

Data Types: struct

StockSpec2 — Stock specification for underlying asset 2structure

Stock specification for underlying asset 2. For information on the stock specification, see stockspec.

stockspec can handle other types of underlying assets. For example, for physical commodities the price is represented by StockSpec.Asset, the volatility is represented by StockSpec.Sigma, and the convenience yield is represented by StockSpec.DividendAmounts.

Data Types: struct

Settle — Settlement date for spread optiondate string | nonnegative scalar integer

Settlement date for the spread option, specified as a date string or as a nonnegative scalar integer.

Data Types: char

Maturity — Maturity date for spread optiondate string | nonnegative scalar integer

Maturity date for spread option, specified as a date string or as a nonnegative scalar integer.

Data Types: char

OptSpec — Definition of option string with values 'call' or 'put'

Definition of option as 'call' or 'put', specified as a string.

Data Types: char

Strike — Option strike price valuenonnegative scalar integer

Option strike price value, specified as a scalar integer.

Data Types: single | double

Corr — Correlation between underlying asset pricesscalar integer

Correlation between underlying asset prices, specified as a scalar integer.

Data Types: single | double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: PriceSens = spreadbyls(RateSpec,StockSpec1,StockSpec2,Settle,Maturity,OptSpec,Strike,Corr,'AmericanOpt',1)

'AmericanOpt' — Option type0 European (default) | scalar with values [0,1]

Option type, specified as a scalar integer flag with values:

  • 0 — European

  • 1 — American

For American options, the Longstaff-Schwartz least squares method is used to calculate the early exercise premium.

Data Types: single | double

'NumTrials' — Number of independent sample paths 1000 (default) | nonnegative scalar integer

Number of independent sample paths (simulation trials) specified as a nonnegative scalar integer.

Data Types: single | double

'NumPeriods' — Number of simulation periods per trial100 (default) | nonnegative scalar integer

Number of simulation periods per trial, specified as a nonnegative scalar integer. NumPeriods is considered only when pricing European basket options. For American spread options, NumPeriods is equal to the number of exercise days during the life of the option.

Data Types: single | double

'Z' — Time series array of dependent random variatesvector

Time series array of dependent random variates, specified as a NumPeriods-by-2-by-NumTrials 3-D array. The Z value generates the Brownian motion vector (i.e., Wiener processes) that drives the simulation.

Data Types: single | double

'Antithetic' — Indicator for antithetic samplingfalse (default) | logical flag with value of true or false

Indicator for antithetic sampling, specified with value of true or false.

Data Types: logical

'OutSpec' — Define outputs{'Price'} (default) | string with values 'Price', 'Delta', 'Gamma', 'Vega', 'Lambda', 'Rho', 'Theta', and 'All' | cell array of strings with values 'Price', 'Delta', 'Gamma', 'Vega', 'Lambda', 'Rho', 'Theta', and 'All'

Define outputs specifying NOUT- by-1 or 1-by-NOUT cell array of strings with possible values of 'Price', 'Delta', 'Gamma', 'Vega', 'Lambda', 'Rho', 'Theta', and 'All'.

OutSpec = {'All'} specifies that the output should be Delta, Gamma, Vega, Lambda, Rho, Theta, and Price, in that order. This is the same as specifying OutSpec to include each sensitivity:

Example: OutSpec = {'delta','gamma','vega','lambda','rho','theta','price'}

Data Types: char | cell

Output Arguments

expand all

PriceSens — Expected price and sensitivities of spread optionvector

Expected price and sensitivities of the spread option, returned as a NINST-by-1 vector.

Paths — Simulated paths of correlated state variablesvector

Simulated paths of correlated state variables, returned as a NumPeriods + 1-by-2-by-NumTrials 3-D time series array. Each row of Paths is the transpose of the state vector X(t) at time t for a given trial.

Times — Observation times associated with simulated pathsvector

Observation times associated with simulated paths, returned as a NumPeriods + 1-by-1 column vector of observation times associated with the simulated paths. Each element of Times is associated with the corresponding row of Paths.

Z — Time series array of dependent random variatesvector

Time series array of dependent random variates, returned as a NumPeriods-by-2-by-NumTrials 3-D array when Z is specified as an input argument. If the Z input argument is not specified, then the Z output argument contains the random variates generated internally.

More About

References

Carmona, R., Durrleman, V., "Pricing and Hedging Spread Options," SIAM Review, Vol. 45, No. 4, pp. 627–685, Society for Industrial and Applied Mathematics, 2003.

See Also

| | |

Was this topic helpful?