Touch
Description
Create and price a Touch
instrument object for one or more
Touch instruments using this workflow:
Use
fininstrument
to create aTouch
instrument object for one or more Touch instruments.Use
finmodel
to specify aBlackScholes
,Bates
,Merton
, orHeston
model for theTouch
instrument object.Choose a pricing method.
When using a
BlackScholes
model, usefinpricer
to specify aBlackScholes
or aVannaVolga
pricing method for one or moreBarrier
instruments.When using a
BlackScholes
,Heston
,Bates
, orMerton
model, usefinpricer
to specify anAssetMonteCarlo
pricing method for one or moreTouch
instruments.
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 models and pricing methods for a
Touch
instrument, see Choose Instruments, Models, and Pricers.
Creation
Syntax
Description
creates a TouchOpt
= fininstrument(InstrumentType
,'ExerciseDate
',exercise_date,'BarrierValue
',barrier_value,'PayoffValue
',payoff_value)Touch
instrument object for one or more Touch
instruments by specifying InstrumentType
and sets properties using the
required name-value pair arguments ExerciseDate
,
BarrierValue
, and
PayoffValue
.
sets optional properties using
additional name-value pair arguments in addition to the required arguments
in the previous syntax. For example, TouchOpt
= fininstrument(___,Name,Value
)TouchOpt =
fininstrument("Touch",'ExerciseDate',datetime(2019,1,30),'BarrierValue',110,'PayoffValue',130,'BarrierType',"OT",'PayoffType',"Expiry",'Name',"Touch_option")
creates a Touch
option with an expiry payoff type. You
can specify multiple name-value pair arguments.
Input Arguments
InstrumentType
— Instrument type
string with value "Touch"
| string array with values of "Touch"
| character vector with value 'Touch'
| cell array of character vectors with values of
'Touch'
Instrument type, specified as a string with the value of
"Touch"
, a character vector with the value of
'Touch'
, an
NINST
-by-1
string array with
values of "Touch"
, or an
NINST
-by-1
cell array of
character vectors with values of 'Touch'
.
Data Types: char
| cell
| 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: TouchOpt =
fininstrument("Touch",'ExerciseDate',datetime(2019,1,30),'BarrierValue',110,'PayoffValue',130,'BarrierType',"OT",'PayoffType',"Expiry",'Name',"Touch_option")
Touch
Name-Value Pair ArgumentsExerciseDate
— Option exercise date
datetime array | string array | date character vector
Option exercise date, specified as the comma-separated pair
consisting of 'ExerciseDate'
and a scalar or an
NINST
-by-1
vector using a
datetime array, string array, or date character vectors.
To support existing code, Touch
also
accepts serial date numbers as inputs, but they are not recommended.
If you use date character vectors or strings, the format must be
recognizable by datetime
because
the ExerciseDate
property is stored as a
datetime.
BarrierValue
— Barrier level
scalar numeric | numeric vector
Barrier level, specified as the comma-separated pair consisting of
'BarrierValue'
and a scalar numeric or an
NINST
-by-1
numeric
vector.
Data Types: double
PayoffValue
— Option payoff value
scalar numeric | numeric vector
Option payoff value, specified as the comma-separated pair
consisting of 'PayoffValue'
and a scalar numeric
or an NINST
-by-1
numeric
vector.
Data Types: double
Touch
Name-Value Pair ArgumentsBarrierType
— Barrier type
"OT"
(default) | string with value "OT"
or
"NT"
| string array with values "OT"
or
"NT"
| character vector with value 'OT'
or
'NT'
| cell array of character vectors with values
'OT'
or 'NT'
Barrier type, specified as the comma-separated pair consisting of
'BarrierType'
and a scalar string or
character vector or an
NINST
-by-1
cell array of
character vectors or string array with one of the following values:
'OT'
— One-touchThe one-touch option provides a payoff if the underlying asset ever trades at or beyond the
BarrierValue
. Otherwise, thePayoffValue
is zero.'NT'
— No-touchThe no-touch option provides a payoff if the underlying asset never trades at or beyond the
BarrierValue
. Otherwise, thePayoffValue
is zero.
Data Types: char
| cell
| string
PayoffType
— Payoff type
"Hit"
(default) | string with value "Hit"
or
"Expiry"
| string array with values "Hit"
or
"Expiry"
| character vector with value 'Hit'
or
'Expiry'
| cell array of character vectors with values
'Hit'
or 'Expiry'
Payoff type, specified as the comma-separated pair consisting of
'PayoffType'
and a scalar string or character
vector or an NINST
-by-1
cell
array of character vectors or string array. You can specify
"Expiry"
only when you specify
'OT'
as the BarrierType
.
Note
When you use a BlackScholes
pricer, only the
"Hit"
PayoffType
is supported.
Data Types: char
| cell
| string
Name
— User-defined name for instrument
" "
(default) | string | string array | character vector | cell array of character vectors
User-defined name for one of more instruments, specified as the
comma-separated pair consisting of 'Name'
and a
scalar string or character vector or an
NINST
-by-1
cell array of
character vectors or string array.
Data Types: char
| cell
| string
Properties
ExerciseDate
— Option exercise date
datetime | vector of datetimes
Option exercise date, returned as a scalar datetime or an
NINST
-by-1
vector of
datetimes.
Data Types: datetime
BarrierValue
— Barrier level
scalar numeric | numeric vector
Barrier level, returned as a scalar numeric or an
NINST
-by-1
numeric vector.
Data Types: double
PayoffValue
— Option payoff
scalar numeric | numeric vector
Option payoff, returned as a scalar numeric or an
NINST
-by-1
numeric vector.
Data Types: double
BarrierType
— Barrier type
"OT"
(default) | string with value "OT"
or
"NT"
| string array with values "OT"
or
"NT"
Barrier type, returned as a scalar string or an
NINST
-by-1
string array.
Data Types: string
PayoffType
— Payoff type
"Hit"
(default) | string with value "Hit"
or
"Expiry"
| string array with values "Hit"
or
"Expiry"
Option type, returned as a scalar string or an
NINST
-by-1
string array.
Data Types: string
Name
— User-defined name for instrument
" "
(default) | string | string array
User-defined name for the instrument, returned as a scalar string or an
NINST
-by-1
string array.
Data Types: string
Examples
Price Touch
Instrument Using BlackScholes
Model and AssetMonteCarlo
Pricer
This example shows the workflow to price a Touch
instrument when you use a BlackScholes
model and an AssetMonteCarlo
pricing method.
Create Touch
Instrument Object
Use fininstrument
to create a Touch
instrument object.
TouchOpt = fininstrument("Touch",'ExerciseDate',datetime(2022,9,15),'BarrierValue',100,'PayoffValue',110,'BarrierType',"OT",'Name',"touch_option")
TouchOpt = Touch with properties: ExerciseDate: 15-Sep-2022 BarrierValue: 100 PayoffValue: 110 BarrierType: "ot" PayoffType: "expiry" Name: "touch_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',.2)
BlackScholesModel = BlackScholes 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",BlackScholesModel,'SpotPrice',102,'simulationDates',datetime(2022,9,15))
outPricer = GBMMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.BlackScholes] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Touch Instrument
Use price
to compute the price and sensitivities for the Touch
instrument.
[Price, outPR] = price(outPricer,TouchOpt,["all"])
Price = 91.1862
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _______ ________ _______ _______ ______ ______
91.186 -2.1825 0.038281 -2.4413 -415.45 2.7374 35.998
Price Touch
Instrument Using BlackScholes
Model and AssetMonteCarlo
Pricer with Quasi-Monte Carlo Simulation
This example shows the workflow to price a Touch
instrument when you use a BlackScholes
model and an AssetMonteCarlo
pricing method with quasi-Monte Carlo simulation.
Create Touch
Instrument Object
Use fininstrument
to create a Touch
instrument object.
TouchOpt = fininstrument("Touch",'ExerciseDate',datetime(2022,9,15),'BarrierValue',100,'PayoffValue',110,'BarrierType',"OT",'Name',"touch_option")
TouchOpt = Touch with properties: ExerciseDate: 15-Sep-2022 BarrierValue: 100 PayoffValue: 110 BarrierType: "ot" PayoffType: "expiry" Name: "touch_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',.2)
BlackScholesModel = BlackScholes 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 argument and use the name-value arguments for MonteCarloMethod
and BrownianMotionMethod
.
outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",BlackScholesModel,'SpotPrice',102,'simulationDates',datetime(2022,9,15),'NumTrials',1e3, ... 'MonteCarloMethod',"quasi",'BrownianMotionMethod',"brownian-bridge")
outPricer = GBMMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 102 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.BlackScholes] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "quasi" BrownianMotionMethod: "brownian-bridge"
Price Touch Instrument
Use price
to compute the price and sensitivities for the Touch
instrument.
[Price, outPR] = price(outPricer,TouchOpt,"all")
Price = 91.1570
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _______ ________ _______ _______ ______ ______
91.157 -2.1979 0.038396 -2.4594 -414.83 2.7317 36.009
Price Multiple Touch
Instruments Using BlackScholes
Model and BlackScholes
Pricer
This example shows the workflow to price multiple Touch
instruments when you use a BlackScholes
model and a BlackScholes
pricing method.
Create Touch
Instrument Object
Use fininstrument
to create a Touch
instrument object for three Touch instruments.
TouchOpt = fininstrument("Touch",'ExerciseDate',datetime([2022,9,15 ; 2022,10,15 ; 2022,11,15]),'BarrierValue',[140 ; 160 ; 190],'PayoffValue',170,'BarrierType',"OT",'Name',"touch_option")
TouchOpt=3×1 Touch array with properties:
ExerciseDate
BarrierValue
PayoffValue
BarrierType
PayoffType
Name
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',0.28)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2800 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 BlackScholes
Pricer Object
Use finpricer
to create a BlackScholes
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("analytic",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',135,'DividendValue',0.045)
outPricer = BlackScholes with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 135 DividendValue: 0.0450 DividendType: "continuous"
Price Touch
Instruments
Use price
to compute the prices and sensitivities for the Touch
instruments.
[Price, outPR] = price(outPricer,TouchOpt,["all"])
Price = 3×1
136.5553
99.8742
63.6835
outPR=3×1 priceresult array with properties:
Results
PricerData
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
______ ______ ________ ______ ______ ______ _______
136.56 2.2346 0.005457 2.2092 30.812 3.9013 -465.89
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
______ ______ ________ ______ ______ _________ _______
99.874 1.8197 0.008319 2.4597 120.98 0.0043188 -138.47
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
______ ______ _________ ______ ______ _______ ______
63.683 1.3221 0.0099462 2.8028 182.58 -3.0963 72.793
Price Touch
Instrument Using Heston
Model and AssetMonteCarlo
Pricer
This example shows the workflow to price a Touch
instrument when you use a Heston
model and an AssetMonteCarlo
pricing method.
Create Touch
Instrument Object
Use fininstrument
to create a Touch
instrument object.
TouchOpt = fininstrument("Touch",'ExerciseDate',datetime(2022,9,15),'BarrierValue',110,'PayoffValue',140,'BarrierType',"OT",'Name',"touch_option")
TouchOpt = Touch with properties: ExerciseDate: 15-Sep-2022 BarrierValue: 110 PayoffValue: 140 BarrierType: "ot" PayoffType: "expiry" Name: "touch_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.2,'RhoSV',0.9)
HestonModel = Heston with properties: V0: 0.0320 ThetaV: 0.1000 Kappa: 0.0030 SigmaV: 0.2000 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',112,'simulationDates',datetime(2022,9,15))
outPricer = HestonMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 112 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Heston] DividendType: "continuous" DividendValue: 0 MonteCarloMethod: "standard" BrownianMotionMethod: "standard"
Price Touch
Instrument
Use price
to compute the price and sensitivities for the Touch
instrument.
[Price, outPR] = price(outPricer,TouchOpt,["all"])
Price = 63.5247
outPR = priceresult with properties: Results: [1x8 table] PricerData: [1x1 struct]
outPR.Results
ans=1×8 table
Price Delta Gamma Lambda Rho Theta Vega VegaLT
______ _______ ______ _______ _______ ______ ______ ______
63.525 -7.2363 1.0541 -12.758 -320.21 3.5527 418.94 8.1498
Price Touch
Instrument Using BlackScholes
Model and BlackScholes
Pricer
This example shows the workflow to price a Touch
instrument when you use a BlackScholes
model and a BlackScholes
pricing method.
Create Touch
Instrument Object
Use fininstrument
to create a Touch
instrument object.
TouchOpt = fininstrument("Touch",'ExerciseDate',datetime(2022,9,15),'BarrierValue',140,'PayoffValue',170,'BarrierType',"OT",'Name',"touch_option")
TouchOpt = Touch with properties: ExerciseDate: 15-Sep-2022 BarrierValue: 140 PayoffValue: 170 BarrierType: "ot" PayoffType: "expiry" Name: "touch_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',0.28)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2800 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 BlackScholes
Pricer Object
Use finpricer
to create a BlackScholes
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("analytic",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',135,'DividendValue',0.045)
outPricer = BlackScholes with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 135 DividendValue: 0.0450 DividendType: "continuous"
Price Touch
Instrument
Use price
to compute the price and sensitivities for the Touch
instrument.
[Price, outPR] = price(outPricer,TouchOpt,["all"])
Price = 136.5553
outPR = priceresult with properties: Results: [1x7 table] PricerData: []
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
______ ______ ________ ______ ______ ______ _______
136.56 2.2346 0.005457 2.2092 30.812 3.9013 -465.89
More About
Touch Option
A touch option (also known as a binary barrier option or American digital) is a path-dependent option where the existence and payout depend on the underlying spot's movement during the option life.
The one-touch option pays out if the underlying spot ever trades at or beyond a predetermined barrier level, and zero otherwise. The barrier can be an upper or lower level, triggering a payout for a one-touch call or put option respectively if the price touches or exceeds the barrier during the option's term. The option expires at a fixed date, paying out if the barrier is touched at any point during the term, regardless of the price at expiration.
For more information, see One-Touch and Double One-Touch Options.
Version History
Introduced in R2020bR2022b: Serial date numbers not recommended
Although Touch
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.
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
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)