Main Content

Discount

Create Discount pricer object for Deposit, FRA, Swap, FixedBond, FloatBond, OISFuture, STIRFuture, and OvernightIndexedSwap using ratecurve object

Since R2020a

Description

Create and price a Deposit, FRA, Swap, FixedBond, FloatBond, OISFuture, STIRFuture, and OvernightIndexedSwap instrument object with a ratecurve and a Discount pricing method using this workflow:

  1. Use fininstrument to create a Deposit, FRA, Swap, FixedBond, FloatBond, STIRFuture, OISFuture, or OvernightIndexedSwap instrument object.

  2. Create an interest-rate curve object using ratecurve.

  3. Use finpricer to specify a Discount pricer object for the Deposit, FRA, Swap, FixedBond, FloatBond, STIRFuture, OISFuture, or OvernightIndexedSwap instrument object.

    Note

    If you do not specify ProjectionCurve when you create a Swap or FloatBond instrument with the Discount pricer, the ProjectionCurve value defaults to the DiscountCurve value.

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

For more information on the available instruments, models, and pricing methods for a Deposit, FRA, Swap, FixedBond, or FloatBond instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

example

DiscountPricerObj = finpricer(PricerType,'DiscountCurve',ratecurve_object) creates a Discount pricer object by specifying PricerType and the required name-value pair argument DiscountCurve to set properties using name-value pairs. For example, DiscountPricerObj = finpricer("Discount",'DiscountCurve',ratecurve_obj) creates a Discount pricer object.

Input Arguments

expand all

Pricer type, specified as a string with the value of "Discount" or a character vector with the value of 'Discount'.

Data Types: char | string

Name-Value Arguments

Specify required 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.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: DiscountPricerObj = finpricer("Discount",'DiscountCurve',ratecurve_obj)

ratecurve object for discounting cash flows, specified as the comma-separated pair consisting of 'DiscountCurve' and the name of a previously created ratecurve object.

Data Types: object

Properties

expand all

ratecurve object for discounting cash flows, returned as the ratecurve object.

Data Types: object

Object Functions

priceCompute price for interest-rate instrument with Discount pricer

Examples

collapse all

This example shows the workflow to price a Swap instrument when using 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(2022,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;
 
myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = 
  ratecurve with properties:

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

Create Swap Instrument Object

Use fininstrument to create a Swap instrument object.

SwapOpt = fininstrument("Swap",'Maturity',datetime(2027,1,15),'LegRate',[0.024 0.015],'LegType',["fixed","float"],'ProjectionCurve',myRC,'Name',"swap_instrument")
SwapOpt = 
  Swap with properties:

                     LegRate: [0.0240 0.0150]
                     LegType: ["fixed"    "float"]
                       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-Jan-2027
                        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 Swap instrument.

[Price, outPR] = price(outPricer, SwapOpt,["all"])
Price = -1.3834
outPR = 
  priceresult with properties:

       Results: [1x2 table]
    PricerData: []

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

    -1.3834    0.048336

Version History

Introduced in R2020a