price
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
Use Inflation
Pricer and inflationcurve
to Price InflationBond
Instrument
This example shows the workflow to price an InflationBond
instrument when you use an inflationcurve
object and an Inflation
pricing method.
Create ratecurve
Object
Create a ratecurve
object using ratecurve
.
Settle = datetime(2021,1,15); Type = "zero"; 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: 15-Jan-2021 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create inflationcurve
Object
Create an inflationcurve
object using inflationcurve
.
BaseDate = datetime(2020,10,1); InflationTimes = [0 calyears([1 2 3 4 5 7 10 20 30])]'; InflationIndexValues = [100 102 103.5 105 106.8 108.2 111.3 120.1 130.4 150.2]'; InflationDates = BaseDate + InflationTimes; myInflationCurve = inflationcurve(InflationDates,InflationIndexValues)
myInflationCurve = inflationcurve with properties: Basis: 0 Dates: [10x1 datetime] InflationIndexValues: [10x1 double] ForwardInflationRates: [9x1 double] Seasonality: [12x1 double]
Create InflationBond
Instrument Object
Use fininstrument
to create an InflationBond
instrument object.
IssueDate = datetime(2021,1,1); Maturity = datetime(2026,1,1); CouponRate = 0.02; InflationBond = fininstrument("InflationBond",'IssueDate',IssueDate,'Maturity',Maturity,'CouponRate',CouponRate,'Name',"inflation_bond_instrument")
InflationBond = InflationBond with properties: CouponRate: 0.0200 Period: 2 Basis: 0 Principal: 100 DaycountAdjustedCashFlow: 0 Lag: 3 IssueIndex: NaN BusinessDayConvention: "actual" Holidays: NaT EndMonthRule: 1 IssueDate: 01-Jan-2021 FirstCouponDate: NaT LastCouponDate: NaT Maturity: 01-Jan-2026 Name: "inflation_bond_instrument"
Create Inflation
Pricer Object
Use finpricer
to create an Inflation
pricer object and use the ratecurve
object with the 'DiscountCurve'
name-value pair argument and the inflationcurve
object with the 'InflationCurve'
name-value pair argument.
outPricer = finpricer("Inflation",'DiscountCurve',ZeroCurve,'InflationCurve',myInflationCurve)
outPricer = Inflation with properties: DiscountCurve: [1x1 ratecurve] InflationCurve: [1x1 inflationcurve]
Price InflationBond
Instrument
Use price
to compute the price and sensitivities for the InflationBond
instrument.
[Price,outPR] = price(outPricer,InflationBond)
Price = 112.1856
outPR = priceresult with properties: Results: [1x1 table] PricerData: []
outPR.Results
ans=table
Price
______
112.19
Input Arguments
inpInstrument
— Instrument object
ZeroCouponInflationSwap
object | YearYearInflationSwap
object | InflationBond
object
Instrument object, specified as a scalar or vector of InflationBond
,
YearYearInflationSwap
, or ZeroCouponInflationSwap
instrument objects. Use fininstrument
to create the
InflationBond
,
YearYearInflationSwap
, or ZeroCouponInflationSwap
instrument objects.
Data Types: object
inpSensitivity
— List of sensitivities to compute
"Price"
(default) | string array with values "Price"
and
"All"
| cell array of character vectors with values 'Price'
and
'All'
(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 option
is the same as specifying inpSensitivity
to include each
sensitivity.
Example: inpSensitivity = {'price'}
Data Types: string
| cell
Output Arguments
Price
— Instrument price
numeric
Instrument price, returned as a numeric.
PriceResult
— Price result
PriceResult
object
Price result, returned as an object. The object has the following fields:
PriceResult.Results
— Table of resultsPriceResult.PricerData
— Structure for pricer data
Version History
Introduced in R2021a
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)