Main Content

optstocksensbybls

Determine option prices or sensitivities using Black-Scholes option pricing model

Description

example

PriceSens = optstocksensbybls(RateSpec,StockSpec,Settle,Maturity,OptSpec,Strike) computes option prices or sensitivities using the Black-Scholes option pricing model.

Note

When using StockSpec with optstocksensbybls, you can modify StockSpec to handle other types of underliers when pricing instruments that use the Black-Scholes model.

When pricing Futures (Black model), enter the following in StockSpec:

DivType = 'Continuous'; 
DivAmount = RateSpec.Rates;

When pricing Foreign Currencies (Garman-Kohlhagen model), enter the following in StockSpec:

DivType = 'Continuous'; 
DivAmount = ForeignRate; 

where ForeignRate is the continuously compounded, annualized risk free interest rate in the foreign country.

Alternatively, you can use the Vanilla object to calculate price or sensitivities for vanilla options. For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

example

PriceSens = optstocksensbybls(___,Name,Value) adds an optional name-value pair argument for OutSpec.

Examples

collapse all

This example shows how to compute option prices and sensitivities using the Black-Scholes option pricing model. Consider a European call and put options with an exercise price of $30 that expires on June 1, 2008. The underlying stock is trading at $30 on January 1, 2008 and has a volatility of 30% per annum. The annualized continuously compounded risk-free rate is 5% per annum. Using this data, compute the delta, gamma, and price of the options using the Black-Scholes model.

AssetPrice = 30;
Strike = 30;
Sigma = .30;
Rates = 0.05;
Settle = datetime(2008,1,1);
Maturity = datetime(2008,6,1);

% define the RateSpec and StockSpec
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, 'EndDates',...
Maturity, 'Rates', Rates, 'Compounding',-1, 'Basis', 1);

StockSpec = stockspec(Sigma, AssetPrice);

% define the options
OptSpec = {'call', 'put'};

OutSpec = {'Delta','Gamma','Price'};
[Delta, Gamma, Price] = optstocksensbybls(RateSpec, StockSpec, Settle,...
Maturity, OptSpec, Strike,'OutSpec', OutSpec)
Delta = 2×1

    0.5810
   -0.4190

Gamma = 2×1

    0.0673
    0.0673

Price = 2×1

    2.6126
    1.9941

Input Arguments

collapse all

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

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

stockspec handles several types of underlying assets. For example, for physical commodities the price is StockSpec.Asset, the volatility is StockSpec.Sigma, and the convenience yield is StockSpec.DividendAmounts.

Data Types: struct

Settlement or trade date, specified as a NINST-by-1 vector using a datetime array, string array, or date character vectors.

To support existing code, optstocksensbybls also accepts serial date numbers as inputs, but they are not recommended.

Maturity date for option, specified as a NINST-by-1 vector using a datetime array, string array, or date character vectors.

To support existing code, optstocksensbybls also accepts serial date numbers as inputs, but they are not recommended.

Definition of the option as 'call' or 'put', specified as a NINST-by-1 cell array of character vectors with values 'call' or 'put'.

Data Types: char | cell

Option strike price value, specified as a nonnegative NINST-by-1 vector.

Data Types: double

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: [Delta,Gamma,Price] = optstocksensbybls(RateSpec,StockSpec,Settle,Maturity,OptSpec,Strike,'OutSpec',OutSpec)

Define outputs, specified as the comma-separated pair consisting of 'OutSpec' and a NOUT- by-1 or 1-by-NOUT cell array of character vectors 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

collapse all

Expected future prices or sensitivities values, returned as a NINST-by-1 vector.

Data Types: double

More About

collapse all

Vanilla Option

A vanilla option is a category of options that includes only the most standard components.

A vanilla option has an expiration date and straightforward strike price. American-style options and European-style options are both categorized as vanilla options.

The payoff for a vanilla option is as follows:

  • For a call: max(StK,0)

  • For a put: max(KSt,0)

where:

St is the price of the underlying asset at time t.

K is the strike price.

For more information, see Vanilla Option.

Version History

Introduced in R2008b

expand all