Main Content

parswaprate

Compute par swap rate for Swap instrument

Since R2020b

Description

example

outRate = parswaprate(SwapObject,inCurve) computes a par swap rate for a Swap instrument object.

Examples

collapse all

This example shows the workflow to compute the par swap rate for a vanilla Swap instrument when you use a ratecurve and a Discount pricing method.

Create ratecurve Object

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

Settle = datetime(2018,3,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-Mar-2018
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create Swap Instrument Object

Use fininstrument to create a vanilla Swap instrument object.

Swap = fininstrument("Swap",'Maturity',datetime(2020,9,15),'LegRate',[0.022 0.019 ],'LegType',["float","fixed"],'ProjectionCurve',myRC,'Name',"swap_instrument")
Swap = 
  Swap with properties:

                     LegRate: [0.0220 0.0190]
                     LegType: ["float"    "fixed"]
                       Reset: [2 2]
                       Basis: [0 0]
                    Notional: 100
          LatestFloatingRate: [NaN NaN]
                 ResetOffset: [0 0]
    DaycountAdjustedCashFlow: [0 0]
             ProjectionCurve: [1x2 ratecurve]
       BusinessDayConvention: ["actual"    "actual"]
                    Holidays: NaT
                EndMonthRule: [1 1]
                   StartDate: NaT
                    Maturity: 15-Sep-2020
                        Name: "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 Swap Instrument

Use price to compute the price and sensitivities for the vanilla Swap instrument.

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

       Results: [1x2 table]
    PricerData: []

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

    2.4066    -0.024499

Compute the par swap rate using parswaprate.

outRate = parswaprate(Swap,myRC)
outRate = 0.0287

This example shows the workflow to compute the par swap rate for multiple vanilla Swap instruments when you use a ratecurve and a Discount pricing method.

Create ratecurve Object

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

Settle = datetime(2019,4,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-Apr-2019
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create Swap Instrument Object

Use fininstrument to create a vanilla Swap instrument object for three Swap instruments.

Swap = fininstrument("Swap",'Maturity',datetime([2020,4,15 ; 2021,4,15 ; 2024,4,15]),'LegRate',[0.022 0.019 ],'LegType',["float","fixed"],'ProjectionCurve',myRC,'Name',"swap_instrument")
Swap=3×1 object
  3x1 Swap array with properties:

    LegRate
    LegType
    Reset
    Basis
    Notional
    LatestFloatingRate
    ResetOffset
    DaycountAdjustedCashFlow
    ProjectionCurve
    BusinessDayConvention
    Holidays
    EndMonthRule
    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 Swap Instruments

Use price to compute the prices and sensitivities for the vanilla Swap instruments.

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

    0.8473
    1.8067
    7.2322

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

    Results
    PricerData

outPR.Results
ans=1×2 table
     Price        DV01   
    _______    __________

    0.84728    -0.0099228

ans=1×2 table
    Price       DV01   
    ______    _________

    1.8067    -0.019656

ans=1×2 table
    Price       DV01  
    ______    ________

    7.2322    -0.04664

Compute the par swap rate for each of the three Swap instruments using parswaprate.

outRate = parswaprate(Swap(1),myRC)
outRate = 0.0275
outRate = parswaprate(Swap(2),myRC)
outRate = 0.0281
outRate = parswaprate(Swap(3),myRC)
outRate = 0.0338

Input Arguments

collapse all

Swap object, specified using a previously created Swap instrument object.

Note

If the SwapObject is a vector of instruments, you must use parswaprate separately with each instrument.

Data Types: object

Rate curve, specified as a previously created ratecurve object.

Data Types: object

Output Arguments

collapse all

Par swap rate, returned as a decimal.

More About

collapse all

Par Swap Rate

The par swap rate is the rate that renders a swap value equal to zero.

In other words, the par swap rate is the value of the fixed rate that gives the swap a zero present value, or the fixed rate that makes the value of both legs equal (that is, the value of the fixed leg and the value of the floating leg).

Version History

Introduced in R2020b