Main Content

inflationCashflows

Compute cash flows for ZeroCouponInflationSwap instrument

Description

example

outCF = inflationCashflows(inpInstrumentObject,Settle,inpInflationCurve) computes cash flows for a ZeroCouponInflationSwap instrument.

Examples

collapse all

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: [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 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
             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: [1x1 ratecurve]
    InflationCurve: [1x1 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: [1x1 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

Input Arguments

collapse all

Instrument object, specified using a previously created instrument object for a ZeroCouponInflationSwap.

Data Types: object

Settlement date for instrument cash flow, specified as a scalar using a datetime, serial date number, date character vector, or date string.

Note

The Settle date you specify must be before the Maturity date for the ZeroCouponInflationSwap instrument.

Data Types: double | char | datetime | string

Inflation curve, specified using a previously created inflation curve object using inflationcurve.

Data Types: object

Output Arguments

collapse all

Output cash flow, returned as a timetable.

Introduced in R2021a