inflationCashflows
Description
computes cash flows for a outCF
= inflationCashflows(inpInstrumentObject
,Settle
,inpInflationCurve
)ZeroCouponInflationSwap
instrument object.
Examples
This example shows the workflow to price a ZeroCouponInflationSwap
instrument when you use an inflationcurve
object and an Inflation
pricing method. Then use inflationCashflows
to compute the cash flow for the ZeroCouponInflationSwap
instrument.
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: [10×1 datetime] Rates: [10×1 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: [10×1 datetime] InflationIndexValues: [10×1 double] ForwardInflationRates: [9×1 double] Seasonality: [12×1 double]
Create ZeroCouponInflationSwap
Instrument Object
Use fininstrument
to create a ZeroCouponInflationSwap
instrument object.
StartDate = datetime(2021,1,1); Maturity = datetime(2022,10,1); FixedInflationRate = 0.015; Notional = 2000; ZCInflationSwap = fininstrument("ZeroCouponInflationSwap",'StartDate',StartDate,'Maturity',Maturity,'FixedInflationRate',FixedInflationRate,'Notional',Notional,'Name',"zero_coupon_inflation_swap_instrument")
ZCInflationSwap = ZeroCouponInflationSwap with properties: Notional: 2000 FixedInflationRate: 0.0150 Basis: 0 Lag: 3 IssueIndex: NaN StartDate: 01-Jan-2021 Maturity: 01-Oct-2022 Name: "zero_coupon_inflation_swap_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: [1×1 ratecurve] InflationCurve: [1×1 inflationcurve]
Price ZeroCouponInflationSwap
Instrument
Use price
to compute the price and sensitivities for the ZeroCouponInflationSwap
instrument.
[Price,outPR] = price(outPricer,ZCInflationSwap,"all")
Price = 9.5675
outPR = priceresult with properties: Results: [1×1 table] PricerData: []
outPR.Results
ans=table
Price
______
9.5675
Compute Cash Flow for ZeroCouponInflationSwap
Instrument
Use inflationCashflows
to compute the cash flow for the ZeroCouponInflationSwap
instrument.
outCF = inflationCashflows(ZCInflationSwap,datetime(2021,1,1),myInflationCurve)
outCF=1×2 timetable
Time Var1 Var2
___________ _______ ______
01-Oct-2022 -52.732 62.397
This example shows the workflow to price multiple ZeroCouponInflationSwap
instruments when you use an inflationcurve
object and an Inflation
pricing method. Then use inflationCashflows
to compute the cash flow for the ZeroCouponInflationSwap
instruments.
Create ratecurve
Object
Create a ratecurve
object using ratecurve
.
Settle = datetime(2021,12,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: [10×1 datetime] Rates: [10×1 double] Settle: 15-Dec-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: [10×1 datetime] InflationIndexValues: [10×1 double] ForwardInflationRates: [9×1 double] Seasonality: [12×1 double]
Create ZeroCouponInflationSwap
Instrument Object
Use fininstrument
to create a ZeroCouponInflationSwap
instrument object for three Zero-Coupon Inflation Swap instruments.
StartDate = datetime([2021,5,1 ; 2021,6,1 ; 2021,7,1]); Maturity = datetime([2022,10,1 ; 2022,11,1 ;2022,12,1]); FixedInflationRate = 0.015; Notional = [20000 ; 30000 ; 40000]; ZCInflationSwap = fininstrument("ZeroCouponInflationSwap",'StartDate',StartDate,'Maturity',Maturity,'FixedInflationRate',FixedInflationRate,'Notional',Notional,'Name',"zero_coupon_inflation_swap_instrument")
ZCInflationSwap=3×1 ZeroCouponInflationSwap array with properties:
Notional
FixedInflationRate
Basis
Lag
IssueIndex
StartDate
Maturity
Name
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: [1×1 ratecurve] InflationCurve: [1×1 inflationcurve]
Price ZeroCouponInflationSwap
Instruments
Use price
to compute the prices and sensitivities for the ZeroCouponInflationSwap
instruments.
[Price,outPR] = price(outPricer,ZCInflationSwap,"all")
Price = 3×1
59.4576
80.6037
89.4137
outPR=1×3 priceresult array with properties:
Results
PricerData
outPR.Results
ans=table
Price
______
59.458
ans=table
Price
______
80.604
ans=table
Price
______
89.414
Compute Cash Flow for ZeroCouponInflationSwap
Instruments
Use inflationCashflows
to compute the cash flow for the ZeroCouponInflationSwap
instruments.
outCF = inflationCashflows(ZCInflationSwap(1),datetime(2022,1,1),myInflationCurve)
outCF=1×2 timetable
Time Var1 Var2
___________ _______ _____
01-Oct-2022 -427.09 486.8
outCF = inflationCashflows(ZCInflationSwap(2),datetime(2022,1,1),myInflationCurve)
outCF=1×2 timetable
Time Var1 Var2
___________ _______ ______
01-Nov-2022 -640.63 721.62
outCF = inflationCashflows(ZCInflationSwap(3),datetime(2022,1,1),myInflationCurve)
outCF=1×2 timetable
Time Var1 Var2
___________ _______ ______
01-Dec-2022 -854.18 944.06
Input Arguments
Instrument object, specified using a previously created instrument object for a
ZeroCouponInflationSwap
.
Note
If the inpInstrumentObject
is a vector of instruments, you
must use inflationCashflows
separately with each
instrument.
Data Types: object
Settlement date for instrument cash flow, specified as a scalar datetime, string, or date character vector.
Note
The Settle
date you specify must be before the
Maturity
date for the ZeroCouponInflationSwap
instrument.
To support existing code, inflationCashflows
also
accepts serial date numbers as inputs, but they are not recommended.
Inflation curve, specified using a previously created inflation curve object using
inflationcurve
.
Data Types: object
Output Arguments
Output cash flow, returned as a timetable.
Version History
Introduced in R2021aAlthough inflationCashflows
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.
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.
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)