AssetMonteCarlo
Create AssetMonteCarlo
pricer object for equity instruments
using BlackScholes
, Merton
,
Heston
, or Bates
model
Since R2020b
Description
Create and price a Vanilla
, Barrier
,
Lookback
, PartialLookback
,
Asian
, Spread
,
DoubleBarrier
, Cliquet
,
Touch
, DoubleTouch
, Binary
instrument object with a BlackScholes
, Bachelier
,
Merton
, Heston
, or Bates
model and a AssetMonteCarlo
pricing method using this
workflow:
Use
fininstrument
to create aVanilla
,Barrier
,Lookback
,PartialLookback
,Asian
,Spread
,DoubleBarrier
,Cliquet
,Binary
,Touch
, orDoubleTouch
instrument object.Use
finmodel
to specify aBlackScholes
model for theVanilla
,Barrier
,Lookback
,PartialLookback
,Asian
,Spread
,DoubleBarrier
,Cliquet
,Touch
,DoubleTouch
, orBinary
instrument object.Use
finmodel
to specify aBachelier
model for theVanilla
,Spread
orBinary
instrument object.Use
finmodel
to specify aMerton
,Bates
, orHeston
model for theVanilla
,Barrier
,Lookback
,PartialLookback
,Asian
,DoubleBarrier
,Touch
,DoubleTouch
,Cliquet
, orBinary
instrument object.Use
finpricer
to specify anAssetMonteCarlo
pricer object for theVanilla
,Barrier
,Lookback
,PartialLookback
,Asian
,Spread
,DoubleBarrier
,Cliquet
,Touch
,DoubleTouch
, orBinary
instrument object.
For more information on this workflow, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.
For more information on the available instruments, models, and pricing methods for
Vanilla
, Barrier
, Lookback
,
PartialLookback
, Asian
,
Spread
, DoubleBarrier
,
Cliquet
, Touch
,
DoubleTouch
, or Binary
instruments, see Choose Instruments, Models, and Pricers.
Creation
Syntax
Description
creates a AssetMonteCarloPricerObj
= finpricer(PricerType
,'Model
',model,'DiscountCurve
',ratecurve_obj,'SpotPrice
',spotprice_value,'SimulationDates
',simulation_dates)AssetMonteCarlo
pricer object by specifying
PricerType
and sets the properties using
the required name-value pair arguments Model
,
DiscountCurve
, SpotPrice
, and
SimulationDates
.
sets optional properties using
additional name-value pairs in addition to the required arguments in the
previous syntax. For example, AssetMonteCarloPricerObj
= finpricer(___,Name,Value
)AssetMonteCarloPricerObj =
finpricer("assetmontecarlo",'Model',BSModel,'DiscountCurve',ratecurve_obj,'SpotPrice',1000,'SimulationDates',[datetime(2018,1,30);
datetime(2019,1,30)],'NumTrials',500,'DividendType','continuous','DividendValue',0.3)
creates an AssetMonteCarlo
pricer object using a
BlackScholes
model. You can specify multiple
name-value pair arguments.
You can perform quasi-Monte Carlo simulations using the name-value
arguments for MonteCarloMethod
and
BrownianMotionMethod
. For more information, see
Quasi-Monte Carlo Simulation.
Input Arguments
PricerType
— Pricer type
string with value "AssetMonteCarlo"
| character vector with value
'AssetMonteCarlo'
Pricer type, specified as a string with the value
"AssetMonteCarlo"
or a character vector with the
value 'AssetMonteCarlo'
.
Data Types: char
| string
Specify required
and 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: AssetMonteCarloPricerObj =
finpricer("assetmontecarlo",'Model',BSModel,'DiscountCurve',ratecurve_obj,'SpotPrice',1000,'SimulationDates',[datetime(2018,1,30);
datetime(2019,1,30)],'NumTrials',500,'DividendType','continuous','DividendValue',0.3)
AssetMonteCarlo
Name-Value Pair
ArgumentsModel
— Model
BlackScholes
object | Merton
object | Bates
object | Heston
object
Model, specified as the comma-separated pair consisting of
'Model'
and the name of a previously created
BlackScholes
, Merton
,
Bates
, or
Heston
model object. Create the model object using finmodel
.
Data Types: object
DiscountCurve
— ratecurve
object for discounting cash flows
ratecurve
object
ratecurve
object for discounting cash flows,
specified as the comma-separated pair consisting of
'DiscountCurve'
and the name of a previously
created ratecurve
object.
Note
Specify a flat ratecurve
object for
DiscountCurve
. If you use a nonflat
ratecurve
object, the software uses
the rate in the ratecurve
object at
Maturity
and assumes that the value
is constant for the life of the equity option.
Data Types: object
SpotPrice
— Current price of underlying asset
nonnegative numeric | positive or negative numeric when using Bachelier
model
Current price of the underlying asset, specified as the
comma-separated pair consisting of 'SpotPrice'
and a scalar nonnegative numeric or scalar positive or negative
numeric when using Bachelier
model.
Note
If you use a Vanilla
, Binary
, or Spread
instrument with a Bachelier
model, the
SpotPrice
can be a negative numeric
value.
Data Types: double
SimulationDates
— Simulation dates
[ ]
(default) | datetime array | string array | date character vector
Simulation dates, specified as the comma-separated pair consisting
of 'SimulationDates'
and a scalar or a vector
using a datetime array, string array, or date character
vectors.
To support existing code, AssetMonteCarlo
also
accepts serial date numbers as inputs, but they are not recommended.
AssetMonteCarlo
Name-Value Pair
ArgumentsNumTrials
— Simulation trials
1000
(default) | scalar
Simulation trials, specified as the comma-separated pair
consisting of 'NumTrials'
and a scalar number of
independent sample paths.
Data Types: double
RandomNumbers
— Dependent random variates
[ ]
(default) | structure
Dependent random variates, specified as the comma-separated pair
consisting of 'RandomNumbers'
and an
NSimulationDates
-by-NBrownians
-by-NTrials
3D time series array. The 3D time series array has the following fields:
Z
—NSimulationDates
-by-NBrownians
-by-NTrials
3D time series array of dependent random variates used to generate the Brownian motion vector (that is, Wiener processes) that drive the simulation.N
—NSimulationDates
-by-NBrownians
-by-NTrials
3D time series array of dependent random variates used as the number of jumps.SizeJ
—NSimulationDates
-by-NBrownians
-by-NTrials
3D time series array of dependent random variates used as the jump sizes.
Note
BlackScholes
and Heston
models only require
Z
field.
Data Types: struct
DividendType
— Stock dividend type
"continuous"
(default) | string with value "cash"
or "continuous"
| character vector with value 'cash'
or
'continuous'
Stock dividend type, specified as the comma-separated pair
consisting of 'DividendType'
and a character
vector or string. DividendType
must be either
"cash"
for actual dollar dividends or
"continuous"
for a continuous dividend
yield.
Data Types: char
| string
DividendValue
— Dividend yield or dividend schedule for underlying stock
0
(default) | scalar numeric | timetable
Dividend yield for the underlying stock, specified as the
comma-separated pair consisting of
'DividendValue'
and a scalar numeric for a
dividend yield or a timetable for a dividend schedule.
Note
Specify a scalar if DividendType
is
"continuous"
and a timetable if
DividendType
is
"cash"
.
Data Types: double
| timetable
MonteCarloMethod
— Monte Carlo method to simulate stochastic processes
"standard"
(default) | string with values "standard"
, "quasi"
, or
"randomized-quasi"
| character vector with values 'standard'
,
'quasi'
, or
'randomized-quasi'
Monte Carlo method to simulate stochastic processes, specified as
the comma-separated pair consisting of
'MonteCarloMethod'
and a string or character
vector with one of the following values:
"standard"
— Monte Carlo using pseudo random numbers."quasi"
— Quasi-Monte Carlo using low-discrepancy sequences."randomized-quasi"
— Randomized quasi-Monte Carlo.
For more information on quasi Monte Carlo simulations, see Quasi-Monte Carlo Simulation and for an example using
the 'MonteCarloMethod'
name-value argument, see
Use AssetMonteCarlo Pricer with Quasi-Monte Carlo Simulation and Heston Model to Price Asian Instrument.
Data Types: string
| char
BrownianMotionMethod
— Brownian motion construction method
"standard"
(default) | string with value "brownian-bridge"
or "principal-components"
| character vector with value 'brownian-bridge'
or 'principal-components'
Brownian motion construction method, specified as the
comma-separated pair consisting of
'BrownianMotionMethod'
and a string or
character vector with one of the following values:
"standard"
— The Brownian motion path is found by taking the cumulative sum of the Gaussian variates."brownian-bridge"
— The last step of the Brownian motion path is calculated first, followed by any order between steps until all steps have been determined."principal-components"
— The Brownian motion path is calculated by minimizing the approximation error.
The starting point for a Monte Carlo simulation is the construction of a Brownian motion sample path (or Wiener path). Such paths are built from a set of independent Gaussian variates, using either standard discretization, Brownian-bridge construction, or principal components construction.
Both standard discretization and Brownian-bridge construction
share the same variance and therefore the same resulting convergence
when used with the MonteCarloMethod
using
pseudo random numbers. However, the performance differs between the
two when the MonteCarloMethod
option
"quasi"
is introduced, with faster
convergence seen for "brownian-bridge"
construction option and the fastest convergence when using the
"principal-components"
construction
option.
For more information on quasi Monte Carlo simulations, see Quasi-Monte Carlo Simulation and for an example using
the 'BrownianMotionMethod'
name-value argument,
see Use AssetMonteCarlo Pricer with Quasi-Monte Carlo Simulation and Heston Model to Price Asian Instrument.
Data Types: string
| char
Properties
Model
— Model
object
Model, returned as an object.
Data Types: object
DiscountCurve
— ratecurve
object for discounting cash flows
ratecurve
object
This property is read-only.
ratecurve
object for discounting cash flows, returned
as a ratecurve
object.
Data Types: object
SpotPrice
— Current price of underlying asset
nonnegative numeric | positive or negative numeric when using Bachelier
model
Current price of underlying asset, returned as a scalar nonnegative
numeric or a scalar positive or negative numeric when using
Bachelier
model.
Data Types: double
SimulationDates
— Simulation dates
datetime
Simulation dates, returned as a datetime array.
Data Types: datetime
NumTrials
— Simulation trials
1000
(default) | scalar
Simulation trials, returned as a scalar number of independent sample paths.
Data Types: double
RandomNumbers
— Dependent random variates
[ ]
(default) | structure
Dependent random variates, returned as an
NSimulationDates
-by-NBrownians
-by-NTrials
3D time series array.
Data Types: struct
EarlyExerciseFunction
— Calculation for early exercise premium
@longstaffschwartz_cubic
(default) | function handle
Calculation for the early exercise premium, returned as a scalar function
handle. The default @longstaffschwartz_cubic
uses the
Longstaff-Schwartz least squares method.
Data Types: function_handle
DividendType
— Dividend type
"continuous"
(default) | string with value "cash"
or "continuous"
This property is read-only.
Dividend type, returned as a string. DividendType
is
either "cash"
for actual dollar dividends or
"continuous"
for a continuous dividend yield.
Data Types: string
DividendValue
— Dividend yield or dividend schedule for underlying stock
0
(default) | scalar nonnegative numeric | timetable
Dividend yield or dividend schedule for the underlying stock, returned as a scalar numeric for a dividend yield or a timetable for a dividend schedule.
Data Types: double
| timetable
MonteCarloMethod
— Monte Carlo method to simulate stochastic processes
"standard"
(default) | string with values "standard"
, "quasi"
, or
"randomized-quasi"
| character vector with values 'standard'
,
'quasi'
, or
'randomized-quasi'
Monte Carlo method to simulate stochastic processes, returned as a string or character vector.
Data Types: string
| char
BrownianMotionMethod
— Brownian motion construction method
"standard"
(default) | string with value "brownian-bridge"
or "principal-components"
| character vector with value 'brownian-bridge'
or
'principal-components'
Brownian motion construction method, returned as a string or character vector.
Data Types: string
| char
Object Functions
price | Compute price for equity instrument with AssetMonteCarlo
pricer |
Examples
Use AssetMonteCarlo
Pricer and BlackScholes
Model to Price DoubleBarrier
Instrument
This example shows the workflow to price a DoubleBarrier
instrument when you use a BlackScholes
model and an AssetMonteCarlo
pricing method.
Create DoubleBarrier
Instrument Object
Use fininstrument
to create a DoubleBarrier
instrument object.
DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',100,'ExerciseDate',datetime(2020,8,15),'OptionType',"call",'ExerciseStyle',"american",'BarrierType',"DKO",'BarrierValue',[110 80],'Name',"doublebarrier_option")
DoubleBarrierOpt = DoubleBarrier with properties: OptionType: "call" Strike: 100 BarrierValue: [110 80] ExerciseStyle: "american" ExerciseDate: 15-Aug-2020 BarrierType: "dko" Rebate: [0 0] Name: "doublebarrier_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes","Volatility",0.3)
BlackScholesModel = BlackScholes with properties: Volatility: 0.3000 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2017,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-2017 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
ExerciseDate = datetime(2020,08,15); Settle = datetime(2017,9,15); outPricer = finpricer("AssetMonteCarlo","DiscountCurve",myRC,"Model",BlackScholesModel,'SpotPrice',100,'simulationDates', Settle+days(1):days(1):ExerciseDate);
Price DoubleBarrier
Instrument
Use price
to compute the price and sensitivities for the DoubleBarrier
instrument.
[Price, outPR] = price(outPricer,DoubleBarrierOpt,"all")
Price = 6.9667
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _______ _________ ______ _______ ______ _______
6.9667 0.26875 -0.096337 3.8576 0.39855 9.5406 -1.2907
Use Asset Monte-Carlo Pricer and Heston Model to Price Asian Instrument
This example shows the workflow to price a fixed-strike Asian
instrument when you use a Heston
model and an AssetMonteCarlo
pricing method.
Create Asian
Instrument Object
Use fininstrument
to create an Asian
instrument object.
AsianOpt = fininstrument("Asian",'ExerciseDate',datetime(2022,9,15),'Strike',100,'OptionType',"put",'Name',"asian_option")
AsianOpt = Asian with properties: OptionType: "put" Strike: 100 AverageType: "arithmetic" AveragePrice: 0 AverageStartDate: NaT ExerciseStyle: "european" ExerciseDate: 15-Sep-2022 Name: "asian_option"
Create Heston
Model Object
Use finmodel
to create a Heston
model object.
HestonModel = finmodel("Heston",'V0',0.032,'ThetaV',0.1,'Kappa',0.003,'SigmaV',0.02,'RhoSV',0.9)
HestonModel = Heston with properties: V0: 0.0320 ThetaV: 0.1000 Kappa: 0.0030 SigmaV: 0.0200 RhoSV: 0.9000
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 AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",HestonModel,'SpotPrice',80,'simulationDates',Settle+calmonths(1):calmonths(1):datetime(2022,9,15))
outPricer = HestonMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 80 SimulationDates: [15-Oct-2018 15-Nov-2018 15-Dec-2018 15-Jan-2019 15-Feb-2019 15-Mar-2019 15-Apr-2019 15-May-2019 15-Jun-2019 15-Jul-2019 15-Aug-2019 15-Sep-2019 15-Oct-2019 ... ] (1x48 datetime) NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Heston] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Asian
Instrument
Use price
to compute the price and sensitivities for the Asian
instrument.
[Price, outPR] = price(outPricer,AsianOpt,"all")
Price = 14.7999
outPR = priceresult with properties: Results: [1x8 table] PricerData: [1x1 struct]
outPR.Results
ans=1×8 table
Price Delta Gamma Lambda Rho Theta Vega VegaLT
_____ ________ ________ _______ _______ _______ ______ _______
14.8 -0.71073 0.023453 -3.8418 -173.12 0.61794 27.992 0.15319
Use AssetMonteCarlo
Pricer with Quasi-Monte Carlo Simulation and Heston
Model to Price Asian
Instrument
This example shows the workflow to price a fixed-strike Asian
instrument when you use a Heston
model and an AssetMonteCarlo
pricing method with name-value arguments for MonteCarloMethod
and BrownianMotionMethod
.
Create Asian
Instrument Object
Use fininstrument
to create an Asian
instrument object.
AsianOpt = fininstrument("Asian",'ExerciseDate',datetime(2022,9,15),'Strike',100,'OptionType',"put",'Name',"asian_option")
AsianOpt = Asian with properties: OptionType: "put" Strike: 100 AverageType: "arithmetic" AveragePrice: 0 AverageStartDate: NaT ExerciseStyle: "european" ExerciseDate: 15-Sep-2022 Name: "asian_option"
Create Heston
Model Object
Use finmodel
to create a Heston
model object.
HestonModel = finmodel("Heston",'V0',0.032,'ThetaV',0.1,'Kappa',0.003,'SigmaV',0.02,'RhoSV',0.9)
HestonModel = Heston with properties: V0: 0.0320 ThetaV: 0.1000 Kappa: 0.0030 SigmaV: 0.0200 RhoSV: 0.9000
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 AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the DiscountCurve
along with the MonteCarloMethod
and BrownianMotionMethod
name-value arguments.
outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",HestonModel,'SpotPrice',80, ... 'SimulationDates',Settle+calmonths(1):calmonths(1):datetime(2022,9,15),'NumTrials',1e3, ... 'MonteCarloMethod',"quasi",'BrownianMotionMethod',"brownian-bridge")
outPricer = HestonMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 80 SimulationDates: [15-Oct-2018 15-Nov-2018 15-Dec-2018 15-Jan-2019 15-Feb-2019 15-Mar-2019 15-Apr-2019 15-May-2019 15-Jun-2019 15-Jul-2019 15-Aug-2019 15-Sep-2019 15-Oct-2019 ... ] (1x48 datetime) NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Heston] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "quasi" BrownianMotionMethod: "brownian-bridge"
Price Asian
Instrument
Use price
to compute the price and sensitivities for the Asian
instrument.
[Price, outPR] = price(outPricer,AsianOpt,"all")
Price = 14.7861
outPR = priceresult with properties: Results: [1x8 table] PricerData: [1x1 struct]
outPR.Results
ans=1×8 table
Price Delta Gamma Lambda Rho Theta Vega VegaLT
______ ________ ________ _______ _______ _______ ______ _______
14.786 -0.69748 0.013922 -3.7737 -170.46 0.48825 28.393 0.15863
Use AssetMonteCarlo
Pricer and Bachelier
Model to Price American Option for Vanilla
Instrument
This example shows the workflow to price an American option for a Vanilla
instrument when you use a Bachelier
model and an AssetMonteCarlo
pricing method.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'Strike',105,'ExerciseDate',datetime(2022,9,15),'OptionType',"call",'ExerciseStyle',"american",'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "call" ExerciseStyle: "american" ExerciseDate: 15-Sep-2022 Strike: 105 Name: "vanilla_option"
Create Bachelier
Model Object
Use finmodel
to create a Bachelier
model object.
BachelierModel = finmodel("Bachelier","Volatility",0.2)
BachelierModel = Bachelier with properties: Volatility: 0.2000 Correlation: 1
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 AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",BachelierModel,'SpotPrice',150,'simulationDates',datetime(2022,9,15))
outPricer = BachelierMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 150 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Bachelier] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(outPricer,VanillaOpt,["all"])
Price = 57.3776
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _______ __________ ______ ______ _______ ___________
57.378 0.99107 -1.579e-14 2.5909 291.94 -2.5576 -2.1316e-10
Use AssetMonteCarlo
Pricer and Bachelier
Model to Price Binary
Instrument With Underlying Negative Value
This example shows the workflow to price a Binary
instrument with an underlying negatively valued asset when you use a Bachelier
model and an AssetMonteCarlo
pricing method.
Create Binary
Instrument Object
Use fininstrument
to create a Binary
instrument object.
BinaryOpt = fininstrument("Binary",'ExerciseDate',datetime(2022,9,15),'Strike',15,'PayoffValue',13,'OptionType',"put",'Name',"binary_option")
BinaryOpt = Binary with properties: OptionType: "put" ExerciseDate: 15-Sep-2022 Strike: 15 PayoffValue: 13 ExerciseStyle: "european" Name: "binary_option"
Create Bachelier
Model Object
Use finmodel
to create a Bachelier
model object.
BachelierModel = finmodel("Bachelier","Volatility",0.2)
BachelierModel = Bachelier with properties: Volatility: 0.2000 Correlation: 1
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 AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument. Note that when using a Bachelier model with a Vanilla, Binary, or Spread instrument, the SpotPrice
can be a positive or negative numeric value.
outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",BachelierModel,'SpotPrice',-6,'simulationDates',datetime(2022,9,15))
outPricer = BachelierMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: -6 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Bachelier] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Binary
Instrument
Use price
to compute the price and sensitivities for the Binary
instrument.
[Price, outPR] = price(outPricer,BinaryOpt,["all"])
Price = 11.3017
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _____ _____ ______ _______ _______ ____
11.302 0 0 0 -45.198 0.39582 0
More About
Quasi-Monte Carlo Simulation
Quasi-Monte Carlo simulation is a Monte Carlo simulation that uses quasi-random sequences instead of pseudo random numbers.
The quasi-random sequences, also called low-discrepancy sequences, are deterministic, uniformly distributed sequences that are specifically designed to place sample points as uniformly as possible. In many cases, this distributed sequences improves the performance of Monte Carlo simulations with faster computational times and sometimes higher accuracy.
The standard Monte Carlo simulation using pseudo random numbers has a convergence rate of only O(N-1/2), while the quasi-Monte Carlo rate of convergence can be much faster with an error of O(N-1) in the best cases. For example, for a standard Monte Carlo simulation, it is necessary to increase 100 times the number of simulations NTrials to reduce the error by a factor of 10, whereas a quasi-Monte Carlo simulation requires less, or much less, than 100 times to achieve the same goal.
Quasi-Monte Carlo simulation produces a purely deterministic result. Therefore, when computing the variance and constructing a confidence band for the estimates, randomized quasi-Monte Carlo simulation is useful because of faster computational times and sometimes higher accuracy. You can also use randomized quasi-Monte Carlo to introduce randomization into the low-discrepancy sequences.
The starting point for a Monte Carlo simulation is the construction of a Brownian motion sample path (or Wiener path). Such paths are built from a set of independent Gaussian variates, using either standard discretization, or Brownian-bridge construction, or principal components construction.
For examples of using the MonteCarloMethod
and
BrownianMotionMethod
name-value arguments to perform
Quasi-Monte Carlo simulation with the AssetMonteCarlo
pricer, see
the following:
Version History
Introduced in R2020bR2023b: Perform Quasi-Monte Carlo simulation
Perform Quasi-Monte Carlo simulation using the name-value argument
MonteCarloMethod
.
R2023b: Perform Brownian bridge and principal components construction
Perform Brownian bridge and principal components construction using the name-value
argument BrownianMotionMethod
.
R2022b: Serial date numbers not recommended
Although AssetMonteCarlo
supports serial date numbers,
datetime
values are recommended instead. The
datetime
data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.
To convert serial date numbers or text to datetime
values, use the datetime
function. For example:
t = datetime(738427.656845093,"ConvertFrom","datenum"); y = year(t)
y = 2021
There are no plans to remove support for serial date number inputs.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)