Workflow to Price an Equity, Commodity, or FX Instrument
Price a Vanilla option with the Black-Scholes closed form formula. For more information on the supported equity, commodity, or FX instruments, see Choose Instruments, Models, and Pricers.
Price Vanilla Instrument Using Black-Scholes Model and Black-Scholes Pricer
This example shows the workflow to price a Vanilla
instrument when you use a BlackScholes
model and a BlackScholes
pricing method.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2018,5,1),'Strike',29,'OptionType',"put",'ExerciseStyle',"european",'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "put" ExerciseStyle: "european" ExerciseDate: 01-May-2018 Strike: 29 Name: "vanilla_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',0.25)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2500 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,1,1); Maturity = datetime(2019,1,1); Rate = 0.05; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',1)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 1 Dates: 01-Jan-2019 Rates: 0.0500 Settle: 01-Jan-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',30,'DividendValue',0.045)
outPricer = BlackScholes with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 30 DividendValue: 0.0450 DividendType: "continuous"
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(outPricer,VanillaOpt,["all"])
Price = 1.2046
outPR = priceresult with properties: Results: [1x7 table] PricerData: []
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Rho Theta
______ ________ ________ _______ ______ _______ _______
1.2046 -0.36943 0.086269 -9.3396 6.4702 -4.0959 -2.3107
See Also
fininstrument
| finmodel
| finpricer