Main Content

inflationCashflows

Compute cash flows for YearYearInflationSwap instrument

Description

example

outCF = inflationCashflows(inpInstrumentObject,Settle,inpInflationCurve) computes cash flows for an YearYearInflationSwap instrument object.

Examples

collapse all

This example shows the workflow to price a YearYearInflationSwap instrument when you use an inflationcurve object and an Inflation pricing method. Then use inflationCashflows to compute the cash flows for the YearYearInflationSwap 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 YearYearInflationSwap Instrument Object

Use fininstrument to create a YearYearInflationSwap instrument object.

Maturity = datetime(2025,1,1);
FixedInflationRate = 0.015;
Notional = 2000;

YYInflationSwap = fininstrument("YearYearInflationSwap",'Maturity',Maturity,'FixedInflationRate',FixedInflationRate,'Notional',Notional,'Name',"YYInflationSwap_instrument")
YYInflationSwap = 
  YearYearInflationSwap with properties:

              Notional: 2000
    FixedInflationRate: 0.0150
                 Basis: 0
                   Lag: 3
              Maturity: 01-Jan-2025
                  Name: "YYInflationSwap_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 YearYearInflationSwap Instrument

Use price to compute the price and sensitivities for the YearYearInflationSwap instrument.

[Price,outPR] = price(outPricer,YYInflationSwap,"all")
Price = 12.5035
outPR = 
  priceresult with properties:

       Results: [1x1 table]
    PricerData: []

outPR.Results
ans=table
    Price 
    ______

    12.504

Compute Cash Flows for YearYearInflationSwap Instrument

Use inflationCashflows to compute the cash flows for the YearYearInflationSwap instrument.

outCF = inflationCashflows(YYInflationSwap,datetime(2021,1,15),myInflationCurve)
outCF=4×2 timetable
       Time        Var1     Var2 
    ___________    ____    ______

    01-Jan-2022    -30         40
    01-Jan-2023    -30     29.412
    01-Jan-2024    -30     28.986
    01-Jan-2025    -30     34.286

This example shows the workflow to price multiple YearYearInflationSwap instrument when you use an inflationcurve object and an Inflation pricing method. Then use inflationCashflows to compute the cash flows for the YearYearInflationSwap instruments.

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(2019,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 YearYearInflationSwap Instrument Object

Use fininstrument to create a YearYearInflationSwap instrument object for three Year-on-Year Inflation-Indexed Swap instruments.

Maturity = datetime([2024,1,1 ; 2024,11,1 ; 2024,12,1]);
FixedInflationRate = 0.015;
Notional = [20000 ; 30000 ; 40000];

YYInflationSwap = fininstrument("YearYearInflationSwap",'Maturity',Maturity,'FixedInflationRate',FixedInflationRate,'Notional',Notional,'Name',"YYInflationSwap_instrument")
YYInflationSwap=3×1 object
  3x1 YearYearInflationSwap array with properties:

    Notional
    FixedInflationRate
    Basis
    Lag
    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: [1x1 ratecurve]
    InflationCurve: [1x1 inflationcurve]

Price YearYearInflationSwap Instruments

Use price to compute the prices and sensitivities for the YearYearInflationSwap instruments.

[Price,outPR] = price(outPricer,YYInflationSwap,"all")
Price = 3×1

   26.0701
   18.1540
    1.3201

outPR=1×3 object
  1x3 priceresult array with properties:

    Results
    PricerData

outPR.Results
ans=table
    Price
    _____

    26.07

ans=table
    Price 
    ______

    18.154

ans=table
    Price 
    ______

    1.3201

Compute Cash Flows for YearYearInflationSwap Instruments

Use inflationCashflows to compute the cash flows for the YearYearInflationSwap instruments.

outCF = inflationCashflows(YYInflationSwap(1),datetime(2021,1,15),myInflationCurve)
outCF=3×2 timetable
       Time        Var1     Var2 
    ___________    ____    ______

    01-Jan-2022    -300    294.12
    01-Jan-2023    -300    289.86
    01-Jan-2024    -300    342.86

outCF = inflationCashflows(YYInflationSwap(2),datetime(2021,1,15),myInflationCurve)
outCF=4×2 timetable
       Time        Var1     Var2 
    ___________    ____    ______

    01-Nov-2021    -450    467.39
    01-Nov-2022    -450    435.85
    01-Nov-2023    -450    500.98
    01-Nov-2024    -450    413.63

outCF = inflationCashflows(YYInflationSwap(3),datetime(2021,1,15),myInflationCurve)
outCF=4×2 timetable
       Time        Var1     Var2 
    ___________    ____    ______

    01-Dec-2021    -600    605.42
    01-Dec-2022    -600    580.41
    01-Dec-2023    -600    676.99
    01-Dec-2024    -600     537.7

Input Arguments

collapse all

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

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 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 YearYearInflationSwap 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