Main Content

optstockbyls

Price European, Bermudan, or American vanilla options using Monte Carlo simulations

Description

Price = optstockbyls(RateSpec,StockSpec,OptSpec,Strike,Settle,ExerciseDates) returns vanilla option prices using the Longstaff-Schwartz model. optstockbyls computes prices of European, Bermudan, and American vanilla options.

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

Note

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

example

Price = optstockbyls(___,Name,Value)adds optional name-value pair arguments.

example

[Price,Path,Times,Z] = optstockbyls(RateSpec,StockSpec,OptSpec,Strike,Settle,ExerciseDates) returns vanilla option prices using the Longstaff-Schwartz model.

example

[Price,Path,Times,Z] = optstockbyls(___,Name,Value) adds optional name-value pair arguments.

example

Examples

collapse all

Define the RateSpec.

StartDates = datetime(2013,1,1);
EndDates = datetime(2015,1,1);
Rates = 0.05;
RateSpec = intenvset('ValuationDate', StartDates, 'StartDates', StartDates, ...
'EndDates', EndDates, 'Rates', Rates)
RateSpec = struct with fields:
           FinObj: 'RateSpec'
      Compounding: 2
             Disc: 0.9060
            Rates: 0.0500
         EndTimes: 4
       StartTimes: 0
         EndDates: 735965
       StartDates: 735235
    ValuationDate: 735235
            Basis: 0
     EndMonthRule: 1

Define the StockSpec for the asset.

AssetPrice = 100;
Sigma = 0.1;
StockSpec = stockspec(Sigma, AssetPrice)
StockSpec = struct with fields:
             FinObj: 'StockSpec'
              Sigma: 0.1000
         AssetPrice: 100
       DividendType: []
    DividendAmounts: 0
    ExDividendDates: []

Define the European vanilla option.

OptSpec = 'put';
Settle = datetime(2013,1,1);
ExerciseDates = datetime(2015,1,1);
Strike = 105;

Compute the European vanilla option price using the Longstaff-Schwartz model.

Antithetic = true;
Price = optstockbyls(RateSpec, StockSpec, OptSpec, Strike, Settle, ...
ExerciseDates, 'Antithetic', Antithetic)
Price = 
3.2292

Define the RateSpec.

StartDates = datetime(2013,1,1);
EndDates = datetime(2015,1,1);
Rates = 0.05;
RateSpec = intenvset('ValuationDate', StartDates, 'StartDates', StartDates, ...
'EndDates', EndDates, 'Rates', Rates)
RateSpec = struct with fields:
           FinObj: 'RateSpec'
      Compounding: 2
             Disc: 0.9060
            Rates: 0.0500
         EndTimes: 4
       StartTimes: 0
         EndDates: 735965
       StartDates: 735235
    ValuationDate: 735235
            Basis: 0
     EndMonthRule: 1

Define the StockSpec for the asset.

AssetPrice = 100;
Sigma = 0.1;
StockSpec = stockspec(Sigma, AssetPrice)
StockSpec = struct with fields:
             FinObj: 'StockSpec'
              Sigma: 0.1000
         AssetPrice: 100
       DividendType: []
    DividendAmounts: 0
    ExDividendDates: []

Define the Bermudan vanilla option.

OptSpec = 'put';
Settle = datetime(2013,1,1);
Strike = [105,106];
ExerciseDates = {datetime(2014,1,1),datetime(2015,1,1)};

Compute the Bermudan vanilla option price using the Longstaff-Schwartz model.

Price = optstockbyls(RateSpec, StockSpec, OptSpec, Strike, Settle, ExerciseDates)
Price = 
4.5126

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 underlying asset, specified using StockSpec obtained from stockspec. For information on the stock specification, see stockspec.

stockspec can handle other types of underlying assets. For example, stocks, stock indices, and commodities.

Data Types: struct

Definition of option, specified as 'call' or 'put' using a character vector.

Data Types: char

Option strike price value, specified with nonnegative scalar integer:

  • For a European option, use a scalar of strike price.

  • For a Bermuda option, use a 1-by-NSTRIKES vector of strike prices.

  • For an American option, use a scalar of strike price.

Data Types: single | double

Settlement date or trade date for the vanilla option, specified as a scalar datetime, string, or date character vector.

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

Option exercise dates, specified as a datetime array, string array, or date character vectors as follows:

  • For a European option, use a 1-by-1 vector of dates. For a European option, there is only one ExerciseDates on the option expiry date.

  • For a Bermuda option, use a 1-by-NSTRIKES vector of dates.

  • For an American option, use a 1-by-2 vector of exercise date boundaries. The option can be exercised on any date between or including the pair of dates on that row. If only one non-NaN date is listed, or if ExerciseDates is a 1-by-1 cell array of character vectors, the option can be exercised between Settle and the single listed ExerciseDates.

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

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: Price = optstockbyls(RateSpec,StockSpec,OptSpec,Strike,Settle,ExerciseDates,'AmericanOpt','1','NumTrials','2000')

Option type, specified as the comma-separated pair consisting of 'AmericanOpt' and positive integer scalar flags with values:

  • 0 — European or Bermuda

  • 1 — American

Note

For American and Bermudan options, the Longstaff-Schwartz least squares method is used to calculate the early exercise premium. For more information on the least squares method, see https://people.math.ethz.ch/%7Ehjfurrer/teaching/LongstaffSchwartzAmericanOptionsLeastSquareMonteCarlo.pdf.

Data Types: double

Simulation trials, specified as a scalar number of independent sample paths.

Data Types: double

Simulation periods per trial, specified as a scalar number. NumPeriods is considered only when pricing European vanilla options. For American and Bermuda vanilla options, NumPeriod is equal to the number of Exercise days during the life of the option.

Data Types: double

Dependent random variates used to generate the Brownian motion vector (that is, Wiener processes) that drive the simulation, specified as a be NumPeriods-by-1-by-NumTrials 3-D time series array.

Data Types: double

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

Data Types: logical

Output Arguments

collapse all

Expected price of the vanilla option, returned as a 1-by-1 scalar.

Simulated paths of correlated state variables, returned as a (NumPeriods + 1) -by-1-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.

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.

Dependent random variates, if Z is specified as an optional input argument, the same value is returned. Otherwise, Z contains the random variates generated internally.

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 R2013b

expand all