Main Content

OvernightIndexedSwap

OvernightIndexedSwap instrument object

Since R2021b

Description

Create and price an OvernightIndexedSwap instrument object for one or more Overnight Indexed Swap (OIS) instruments using this workflow:

  1. Use fininstrument to create an OvernightIndexedSwap instrument object for one or more OIS instruments.

  2. Use ratecurve to specify a curve model for the OvernightIndexedSwap instrument object.

  3. Use finpricer to specify a Discount pricing method for one or more OvernightIndexedSwap instruments when using a ratecurve object.

Create an OvernightIndexedSwap instrument object for one or more OIS instruments to use in curve construction using this workflow:

  1. Use fininstrument to create an OvernightIndexedSwap instrument object for one or more OIS instruments.

  2. Use irbootstrap to create an interest-rate curve (ratecurve) for one or more OvernightIndexedSwap instruments.

For more information on these workflows, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

For more information on the available models and pricing methods for an OvernightIndexedSwap instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

example

OvernightIndexedSwapInst = fininstrument(InstrumentType,Maturity=maturity_date,LegRate=leg_rate) creates a OvernightIndexedSwap object for one or more OIS instruments by specifying InstrumentType and sets the properties for the required name-value arguments Maturity and LegRate. The OvernightIndexedSwap instrument supports vanilla Overnight Indexed Swaps, amortizing Overnight Indexed Swaps, and forward Overnight Indexed Swaps.

example

OvernightIndexedSwapInst = fininstrument(___,Name=Value) sets optional properties using additional name-value arguments in addition to the required arguments in the previous syntax. For example, OvernightIndexedSwapInst = fininstrument("OvernightIndexedSwap",Maturity=datetime(2019,1,30),LegRate=[0.06 0.12],LegType=["fixed","fixed"],Basis=1,Notional=100,StartDate=datetime(2018,1,30),DaycountAdjustedCashFlow=true,BusinessDayConvention="follow",ProjectionCurve=ratecurve,Name="overnight_indexed_swap_instrument") creates an OvernightIndexedSwap instrument with a maturity of January 30, 2019. You can specify multiple name-value arguments.

Input Arguments

expand all

Instrument type, specified as a string with the value of "OvernigntIndexedSwap", a character vector with the value of 'OvernigntIndexedSwap', an NINST-by-1 string array with values of "OvernigntIndexedSwap", or an NINST-by-1 cell array of character vectors with values of 'OvernigntIndexedSwap'.

Data Types: char | cell | string

Name-Value Arguments

Specify required and optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: OvernightIndexedSwapInst = fininstrument("OvernightIndexedSwap",Maturity=datetime(2019,1,30),LegRate=[0.06 0.12],LegType=["fixed","fixed"],Basis=1,Notional=100,StartDate=datetime(2018,1,30),DaycountAdjustedCashFlow=true,BusinessDayConvention="follow",ProjectionCurve=ratecurve,Name="overnight_indexed_swap_instrument")

Required OvernightIndexedSwap Name-Value Arguments

expand all

Swap maturity date, specified as Maturity and a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

To support existing code, OvernightIndexedSwap also accepts serial date numbers as inputs, but they are not recommended.

If you use date characters vector or strings, the format must be recognizable by datetime because the Maturity property is stored as a datetime.

Leg rate in decimal values, specified as LegRate and a NINST-by-2 matrix. Each row can be defined as one of the following:

  • [CouponRate Spread] (fixed-float)

  • [Spread CouponRate] (float-fixed)

  • [CouponRate CouponRate] (fixed-fixed)

  • [Spread Spread] (float-float)

CouponRate is the decimal annual rate. Spread is the number of basis points in decimals over the reference rate. The first column represents the receiving leg, while the second column represents the paying leg.

Data Types: double

Optional OvernightIndexedSwap Name-Value Arguments

expand all

OvernightIndexedSwap leg type, specified as LegType and a cell array of character vectors or a string array with the supported values. The LegType defines the interpretation of the values entered in LegRate.

Data Types: cell | string

Rate curve for projecting floating cash flows, specified as ProjectionCurve and a scalar ratecurve object or an NINST-by-1 vector of ratecurve objects. You must create this object using ratecurve. Use this optional input if the forward curve is different from the discount curve.

Data Types: object

Frequency of payments per year, specified as Reset and a scalar or a NINST-by-2 matrix if Reset is different for each leg) with one of the following values: 0, 1, 2, 3, 4, 6, or 12.

Data Types: double

Day count basis representing the basis for each leg, specified as Basis and a NINST-by-1 matrix (or NINST-by-2 matrix if Basis is different for each leg).

  • 0 — actual/actual

  • 1 — 30/360 (SIA)

  • 2 — actual/360

  • 3 — actual/365

  • 4 — 30/360 (PSA)

  • 5 — 30/360 (ISDA)

  • 6 — 30/360 (European)

  • 7 — actual/365 (Japanese)

  • 8 — actual/actual (ICMA)

  • 9 — actual/360 (ICMA)

  • 10 — actual/365 (ICMA)

  • 11 — 30/360E (ICMA)

  • 12 — actual/365 (ISDA)

  • 13 — BUS/252

For more information, see Basis.

Data Types: double

Notional principal amount, specified as Notional and a scalar numeric or an NINST-by-1 numeric vector.

Notional accepts a scalar for a principal amount (or a NINST-by-2 matrix if Notional is different for each leg).

Data Types: double

Historical fixing data, specified as HistoricalFixing and a timetable.

Note

If you are creating one or more OvernightIndexedSwap instruments and use a timetable, the timetable specification applies to all of the OvernightIndexedSwap instruments. HistoricalFixing does not accept an NINST-by-1 cell array of timetables as input.

Data Types: timetable

Lag in rate setting, specified as ResetOffset and a NINST-by-2 matrix.

Data Types: double

Since R2024a

Lag in payment, specified as an NINST-by-2 matrix.

Data Types: double

Business day conventions, specified as BusinessDayConvention and string (or NINST-by-2 string array if BusinessDayConvention is different for each leg) or a character vector (or NINST-by-2 cell array of character vectors if BusinessDayConvention is different for each leg). The selection for business day convention determines how nonbusiness days are treated. Nonbusiness days are defined as weekends plus any other date that businesses are not open (for example, statutory holidays). Values are:

  • "actual" — Nonbusiness days are effectively ignored. Cash flows that fall on nonbusiness days are assumed to be distributed on the actual date.

  • "follow" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the following business day.

  • "modifiedfollow" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the following business day. However, if the following business day is in a different month, the previous business day is adopted instead.

  • "previous" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day.

  • "modifiedprevious" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day. However, if the previous business day is in a different month, the following business day is adopted instead.

Data Types: char | cell | string

Holidays used in computing business days, specified as Holidays and dates using an NINST-by-1 vector of a datetime array, string array, or date character vectors. For example:

H = holidays(datetime('today'),datetime(2025,12,15));
OvernightIndexedSwapInst = fininstrument("OvernightIndexedSwap",Maturity=datetime(2025,12,15),LegRate=[0.06 20],Holidays=H)

To support existing code, OvernightIndexedSwap also accepts serial date numbers as inputs, but they are not recommended.

End-of-month rule flag for generating dates when Maturity is an end-of-month date for a month with 30 or fewer days, specified as EndMonthRule and a logical value of true or false using a NINST-by-1 matrix (or NINST-by-2 matrix if EndMonthRule is different for each leg).

  • If you set EndMonthRule to false, the software ignores the rule, meaning that a payment date is always the same numerical day of the month.

  • If you set EndMonthRule to true, the software sets the rule on, meaning that a payment date is always the last actual day of the month.

Data Types: logical

Since R2024a

Flag to adjust cash flows based on actual period day count, specified as DaycountAdjustedCashFlow and a NINST-by-1 matrix (or NINST-by-2 matrix if DaycountAdjustedCashFlow is different for each leg) of logicals with values of true or false.

Data Types: logical

Date OvernightIndexedSwap starts payments, specified as StartDate and a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

To support existing code, OvernightIndexedSwap also accepts serial date numbers as inputs, but they are not recommended.

Use StartDate to price a forward OvernightIndexedSwap, that is, an OvernightIndexedSwap that starts at a future date.

If you use a date character vector or string, the format must be recognizable by datetime because the StartDate property is stored as a datetime.

User-defined name for the instrument, specified as Name and a scalar string or character vector or an NINST-by-1 cell array of character vectors or string array.

Data Types: char | cell | string

Properties

expand all

Maturity date, returned as a scalar datetime or an NINST-by-1 vector of datetimes.

Data Types: datetime

Leg rate, returned as a NINST-by-2 matrix of decimal values, with each row defined as one of the following:

  • [CouponRate Spread] (fixed-float)

  • [Spread CouponRate] (float-fixed)

  • [CouponRate CouponRate] (fixed-fixed)

  • [Spread Spread] (float-float)

Data Types: double

Leg type, returned as a string array with the values ["fixed","fixed"], ["fixed","float"], ["float","fixed"], or ["float","float"].

Data Types: string

Rate curve used in projecting the future cash flows, returned as a ratecurve object or an NINST-by-1 vector of ratecurve objects.

Data Types: object

Reset frequency per year for each swap, returned as an 1-by-2 matrix.

Data Types: double

Day count basis, returned as an 1-by-2 matrix.

Data Types: double

Lag in rate setting, returned as an NINST-by-2 matrix.

Data Types: double

Since R2024a

Lag in payment, returned as an NINST-by-2 matrix.

Data Types: double

Notional principal amount, returned as a scalar numeric or an NINST-by-1 numeric vector.

Data Types: double

Historical fixing data, returned as a timetable.

Data Types: timetable

Business day conventions, returned as a string or a NINST-by-2 string array if BusinessDayConvention is different for each leg.

Data Types: char | cell | string

Holidays used in computing business days, returned as an NINST-by-1 vector of datetimes.

Data Types: datetime

End-of-month rule flag for generating dates when Maturity is an end-of-month date for a month with 30 or fewer days, returned as an NINST-by-1 matrix (or NINST-by-2 matrix if EndMonthRule is different for each leg).

Data Types: logical

Since R2024a

Flag to adjust cash flows based on actual period day count, returned as an NINST-by-1 matrix (or an NINST-by-2 matrix if DaycountAdjustedCashFlow is different for each leg) of logicals with values of true or false.

Data Types: logical

Date OvernightIndexedSwap starts payments, returned as a scalar datetime or an NINST-by-1 vector of datetimes.

Data Types: datetime

User-defined name for the instrument, returned as a scalar string or an NINST-by-1 string array.

Data Types: string

Object Functions

cashflowsCompute cash flow for FixedBond, FloatBond, Swap, FRA, STIRFuture, OISFuture, OvernightIndexedSwap, or Deposit instrument
parswaprateCompute par swap rate for Swap and OvernightIndexedSwap instrument

Examples

collapse all

This example shows the workflow to price an OvernightIndexedSwap instrument when you use a ratecurve object and a Discount pricing method.

Create ratecurve Object

Create a ratecurve object using ratecurve for the underlying interest-rate curve for the OvernightIndexedSwap instrument.

Settle = datetime(2019,9,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;
 
myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: -1
                Basis: 0
                Dates: [10x1 datetime]
                Rates: [10x1 double]
               Settle: 15-Sep-2019
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create OvernightIndexedSwap Instrument Object

Use fininstrument to create an OvernightIndexedSwap instrument object.

OvernightIndexedSwap = fininstrument("OvernightIndexedSwap",Maturity=datetime(2022,9,15),LegRate=[0.022 0.019 ],LegType=["float","fixed"],Notional=100,ProjectionCurve=myRC,Name="overnight_swap_instrument")
OvernightIndexedSwap = 
  OvernightIndexedSwap with properties:

                     LegRate: [0.0220 0.0190]
                     LegType: ["float"    "fixed"]
                       Reset: [2 2]
                       Basis: [0 0]
                    Notional: 100
            HistoricalFixing: [0x0 timetable]
                 ResetOffset: [0 0]
                PaymentDelay: 0
             ProjectionCurve: [1x1 ratecurve]
       BusinessDayConvention: ["actual"    "actual"]
                    Holidays: NaT
                EndMonthRule: [1 1]
    DaycountAdjustedCashFlow: [0 0]
                   StartDate: NaT
                    Maturity: 15-Sep-2022
                        Name: "overnight_swap_instrument"

Create Discount Pricer Object

Use finpricer to create a Discount pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

outPricer = finpricer("Discount",DiscountCurve=myRC)
outPricer = 
  Discount with properties:

    DiscountCurve: [1x1 ratecurve]

Price OvernightIndexedSwap Instrument

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

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

       Results: [1x2 table]
    PricerData: []

outPR.Results
ans=1×2 table
    Price       DV01   
    ______    _________

    3.0797    -0.029334

Since R2024a

This example shows the workflow to price an OvernightIndexedSwap instrument when you use a ratecurve object and a Discount pricing method and then use parswaprate to compute the par swap rate.

Create ratecurve Object

Create a ratecurve object using ratecurve for the underlying interest-rate curve for the OvernightIndexedSwap instrument.

Settle = datetime(2019,9,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;
 
myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: -1
                Basis: 0
                Dates: [10x1 datetime]
                Rates: [10x1 double]
               Settle: 15-Sep-2019
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create OvernightIndexedSwap Instrument Object

Use fininstrument to create an OvernightIndexedSwap instrument object.

OvernightIndexedSwap = fininstrument("OvernightIndexedSwap",Maturity=datetime(2022,9,15),LegRate=[0.022 0.019 ],LegType=["float","fixed"],Notional=100,ProjectionCurve=myRC,Name="overnight_swap_instrument")
OvernightIndexedSwap = 
  OvernightIndexedSwap with properties:

                     LegRate: [0.0220 0.0190]
                     LegType: ["float"    "fixed"]
                       Reset: [2 2]
                       Basis: [0 0]
                    Notional: 100
            HistoricalFixing: [0x0 timetable]
                 ResetOffset: [0 0]
                PaymentDelay: 0
             ProjectionCurve: [1x1 ratecurve]
       BusinessDayConvention: ["actual"    "actual"]
                    Holidays: NaT
                EndMonthRule: [1 1]
    DaycountAdjustedCashFlow: [0 0]
                   StartDate: NaT
                    Maturity: 15-Sep-2022
                        Name: "overnight_swap_instrument"

Create Discount Pricer Object

Use finpricer to create a Discount pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

outPricer = finpricer("Discount",DiscountCurve=myRC)
outPricer = 
  Discount with properties:

    DiscountCurve: [1x1 ratecurve]

Price OvernightIndexedSwap Instrument

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

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

       Results: [1x2 table]
    PricerData: []

outPR.Results
ans=1×2 table
    Price       DV01   
    ______    _________

    3.0797    -0.029334

Compute Par Swap Rate

Use parswaprate to compute the par swap rate for the OvernightIndexedSwap instrument. The par swap rate is the rate that renders a swap value equal to zero.

outRate = parswaprate(OvernightIndexedSwap,myRC)
outRate = 0.0294

This example shows the workflow to price multiple OvernightIndexedSwap instruments when you use a ratecurve object and a Discount pricing method.

Create ratecurve Object

Create a ratecurve object using ratecurve for the underlying interest-rate curve for the OvernightIndexedSwap instrument.

Settle = datetime(2020,9,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;
 
myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: -1
                Basis: 0
                Dates: [10x1 datetime]
                Rates: [10x1 double]
               Settle: 15-Sep-2020
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create OvernightIndexedSwap Instrument Object

Use fininstrument to create an OvernightIndexedSwap instrument object for three Overnight Indexed Swap instruments.

OvernightIndexedSwap = fininstrument("OvernightIndexedSwap",Maturity=datetime([2022,9,15 ; 2023,9,15 ; 2024,9,15]),LegRate=[0 0.01],LegType=["float","fixed"],Notional=[100 ; 90; 80],ProjectionCurve=myRC,Name="overnight_swap_instrument")
OvernightIndexedSwap=3×1 OvernightIndexedSwap array with properties:
    LegRate
    LegType
    Reset
    Basis
    Notional
    HistoricalFixing
    ResetOffset
    PaymentDelay
    ProjectionCurve
    BusinessDayConvention
    Holidays
    EndMonthRule
    DaycountAdjustedCashFlow
    StartDate
    Maturity
    Name

Create Discount Pricer Object

Use finpricer to create a Discount pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

outPricer = finpricer("Discount",DiscountCurve=myRC)
outPricer = 
  Discount with properties:

    DiscountCurve: [1x1 ratecurve]

Price OvernightIndexedSwap Instruments

Use price to compute the prices for the OvernightIndexedSwap instruments.

Price = price(outPricer,OvernightIndexedSwap)
Price = 3×1

   -0.7735
   -0.7198
   -0.2021

More About

expand all

Version History

Introduced in R2021b

expand all