price
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
.
Examples
Use Credit
Pricer and Default Probability Curve to Price CDS
Instrument
This example shows the workflow to price a CDS
instrument when you use a defprobcurve
model and a Credit
pricing method.
Create CDS
Instrument Object
Use fininstrument
to create a CDS
instrument object.
CDS = fininstrument("cds",'Maturity',datetime(2027,9,20),'ContractSpread', 50,'Name',"CDS_instrument")
CDS = CDS with properties: ContractSpread: 50 Maturity: 20-Sep-2027 Period: 4 Basis: 2 RecoveryRate: 0.4000 BusinessDayConvention: "actual" Holidays: NaT PayAccruedPremium: 1 Notional: 10000000 Name: "CDS_instrument"
Create defprobcurve
Object
Create a defprobcurve
object using defprobcurve
.
Settle = datetime(2017, 9, 20); DefProbTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]; DefaultProbabilities = [0.005 0.007 0.01 0.015 0.026 0.04 0.077 0.093 0.15 0.20]'; ProbDates = Settle + DefProbTimes; DefaultProbCurve = defprobcurve(Settle,ProbDates,DefaultProbabilities)
DefaultProbCurve = defprobcurve with properties: Settle: 20-Sep-2017 Basis: 2 Dates: [10x1 datetime] DefaultProbabilities: [10x1 double]
Create ratecurve
Object
Create a ratecurve
object using ratecurve
.
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;
ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates)
ZeroCurve = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: [10x1 datetime] Rates: [10x1 double] Settle: 20-Sep-2017 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create Credit
Pricer Object
Use finpricer
to create a Credit
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
CDSpricer = finpricer("credit",'DiscountCurve',ZeroCurve,'DefaultProbabilityCurve',DefaultProbCurve)
CDSpricer = Credit with properties: DiscountCurve: [1x1 ratecurve] TimeStep: 10 DefaultProbabilityCurve: [1x1 defprobcurve]
Price CDS
Instrument
Use price
to compute the price for the CDS
instrument.
outPrice = price(CDSpricer, CDS)
outPrice = 6.9363e+04
Input Arguments
inpInstrument
— Instrument object
CDS
object
Instrument object, specified as a scalar or vector of previously created CDS
instrument objects. Use
fininstrument
to create
CDS
instrument objects.
Data Types: object
Output Arguments
Price
— Instrument price
numeric
Instrument price, returned as a numeric.
PriceResult
— Price result
PriceResult
object
Price result, returned as a PriceResult
object. The object has
the following fields:
PriceResult.Results
— Table of results that includes theCDS
price and accrued premiumPriceResult.PricerData
— Structure that includes the premium leg payment dates, times, and cash flows
Version History
Introduced in R2020a
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)