Main Content


Compute par swap rate for Swap instrument



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


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: []

ans=1×2 table
    Price       DV01   
    ______    _________

    2.4066    -0.012056

Compute the par swap rate using parswaprate.

outRate = parswaprate(Swap,myRC)
outRate = 0.0287

Input Arguments

collapse all

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

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).

Introduced in R2020b