price
Compute price for equity instrument with ReplicatingVarianceSwap
pricer
Syntax
Description
[
computes the instrument price and related pricing information based on the pricing object
Price,PriceResult] = price(inpPricer,inpInstrument)inpPricer and the instrument object
inpInstrument.
[
adds an optional argument to specify sensitivities.Price,PriceResult] = price(___,inpSensitivity)
Examples
This example shows the workflow to price a VarianceSwap instrument when you use a ratecurve and a ReplicatingVarianceSwap pricing method.
Create VarianceSwap Instrument Object
Use fininstrument to create a VarianceSwap instrument object.
VarianceSwapInst = fininstrument("VarianceSwap",'Maturity',datetime(2021,5,1),'Notional',150,'StartDate',datetime(2020,5,1),'RealizedVariance',0.05,'Strike',0.1,'Name',"variance_swap_instrument")
VarianceSwapInst =
VarianceSwap with properties:
Notional: 150
RealizedVariance: 0.0500
Strike: 0.1000
StartDate: 01-May-2020
Maturity: 01-May-2021
Name: "variance_swap_instrument"
Create ratecurve Object
Create a flat ratecurve object using ratecurve.
Settle = datetime(2020, 9, 15); ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]'; ZeroDates = Settle + ZeroTimes; Basis = 1; ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates,'Basis',Basis)
ZeroCurve =
ratecurve with properties:
Type: "zero"
Compounding: -1
Basis: 1
Dates: [10×1 datetime]
Rates: [10×1 double]
Settle: 15-Sep-2020
InterpMethod: "linear"
ShortExtrapMethod: "next"
LongExtrapMethod: "previous"
Create ReplicatingVarianceSwap Pricer Object
Use finpricer to create a ReplicatingVarianceSwap pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.
Strike = (50:5:135)'; Volatility = [.49;.45;.42;.38;.34;.31;.28;.25;.23;.21;.2;.21;.21;.22;.23;.24;.25;.26]; VolatilitySmile = table(Strike, Volatility); SpotPrice = 100; CallPutBoundary = 100; outPricer = finpricer("ReplicatingVarianceSwap",'DiscountCurve', ZeroCurve, 'VolatilitySmile', VolatilitySmile, ... 'SpotPrice', SpotPrice, 'CallPutBoundary', CallPutBoundary)
outPricer =
ReplicatingVarianceSwap with properties:
DiscountCurve: [1×1 ratecurve]
InterpMethod: "linear"
VolatilitySmile: [18×2 table]
SpotPrice: 100
CallPutBoundary: 100
Price VarianceSwap Instrument
Use price to compute the price and fair variance for the VarianceSwap instrument.
[Price, outPR] = price(outPricer,VarianceSwapInst,["all"])Price = 8.1997
outPR =
priceresult with properties:
Results: [1×2 table]
PricerData: [1×1 struct]
outPR.Results
ans=1×2 table
Price FairVariance
______ ____________
8.1997 0.21701
outPR.PricerData.ReplicatingPortfolio
ans=19×6 table
CallPut Strike Volatility Weight Value Contribution
_______ ______ __________ __________ _______ ____________
"put" 50 0.49 0.0064038 0.39164 0.002508
"put" 55 0.45 0.0052877 0.49353 0.0026097
"put" 60 0.42 0.0044402 0.67329 0.0029895
"put" 65 0.38 0.0037814 0.80343 0.0030381
"put" 70 0.34 0.0032592 0.9419 0.0030698
"put" 75 0.31 0.0028382 1.223 0.0034711
"put" 80 0.28 0.0024938 1.58 0.0039403
"put" 85 0.25 0.0022086 2.0456 0.0045177
"put" 90 0.23 0.0019696 2.9221 0.0057554
"put" 95 0.21 0.0017675 4.1406 0.0073183
"put" 100 0.2 0.00082405 6.1408 0.0050603
"call" 100 0.2 0.00077087 6.4715 0.0049887
"call" 105 0.21 0.0014465 4.7094 0.0068119
"call" 110 0.21 0.0013178 3.1644 0.0041701
"call" 115 0.22 0.0012056 2.307 0.0027814
"call" 120 0.23 0.0011072 1.7127 0.0018962
⋮
Input Arguments
Pricer object, specified as a scalar ReplicatingVarianceSwap pricer object. Use finpricer to create the ReplicatingVarianceSwap pricer object.
Data Types: object
Instrument object, specified as a scalar VarianceSwap
instrument object. Use fininstrument to create the
VarianceSwap
instrument object.
Data Types: object
(Optional) List of sensitivities to compute, specified as an
NOUT-by-1 or
1-by-NOUT cell array of character vectors or
string array with possible values of 'Price' and
'All'.
inpSensitivity = {'All'} or inpSensitivity =
["All"] specifies that the output is 'Price'. This is the
same as specifying inpSensitivity to include each sensitivity.
Example: inpSensitivity = {'price'}
Data Types: string | cell
Output Arguments
Instrument price, returned as a numeric.
Price result, returned as a PriceResult object. The object has
the following fields:
PriceResult.Results— Table of results that includes:Price— Numeric scalar swap price valueFairVariance— Numeric fair variance in decimals
PriceResult.PricerData.ReplicatingPortfolio— Table containing pricer data
Version History
Introduced in R2020b
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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)