Main Content

FloatBond

FloatBond instrument object

Since R2020a

Description

Create and price a FloatBond instrument object using this workflow:

  1. Use fininstrument to create a FloatBond instrument object.

  2. Use ratecurve to specify a curve model for the FloatBond instrument or use a HullWhite, BlackKarasinski, BlackDermanToy, BraceGatarekMusiela, SABRBraceGatarekMusiela, CoxIngersollRoss, or LinearGaussian2F model.

  3. Choose a pricing method.

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 models and pricing methods for a FloatBond instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

FloatBondObj = fininstrument(InstrumentType,'Spread',spread_value,'Maturity',maturity_date) creates a FloatBond object by specifying InstrumentType and sets the properties for the required name-value pair arguments Spread and Maturity.

The FloatBond instrument supports a vanilla floating rate note and an amortizing floating rate note. For more information, see Floating-Rate Note.

example

FloatBondObj = fininstrument(___,Name,Value) sets optional properties using additional name-value pairs in addition to the required arguments in the previous syntax. For example, FloatBondObj = fininstrument("FloatBond",'Spread',0.6,'Maturity',datetime(2019,1,30),'Basis',1,'Principal',100,'FirstCouponDate',datetime(2016,1,30),'EndMonthRule',true,'Name',"float_bond_instrument") creates a FloatBond instrument with a spread of 0.6 and a maturity of January 30, 2019. You can specify multiple name-value pair arguments.

example

Input Arguments

expand all

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

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.

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

Example: FloatBondObj = fininstrument("FloatBond",'Spread',0.6,'Maturity',datetime(2019,1,30),'Basis',1,'Principal',100,'FirstCouponDate',datetime(2016,1,30),'EndMonthRule',true,'Name',"float_bond_instrument")

Required FloatBond Name-Value Pair Arguments

expand all

Decimal value over the reference rate, specified as the comma-separated pair consisting of 'Spread' and a scalar nonnegative decimal or an NINST-by-1 vector of nonnegative decimals.

Data Types: double

Maturity date, specified as the comma-separated pair consisting of 'Maturity' and a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

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

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

Optional FloatBond Name-Value Pair Arguments

expand all

Frequency of payments per year, specified as the comma-separated pair consisting of 'Reset' and a scalar integer or an NINST-by-1 vector of integers. Values for Reset are: 1, 2, 3, 4, 6, or 12.

Data Types: double

Day count basis, specified as the comma-separated pair consisting of 'Basis' and a scalar integer or an NINST-by-1 using the following values:

  • 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 or principal value schedule, specified as the comma-separated pair consisting of 'Principal' and a scalar numeric or an NINST-by-1 numeric vector or a timetable.

Principal accepts a timetable, where the first column is dates and the second column is the associated notional principal value. The date indicates the last day that the principal value is valid.

Note

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

Data Types: double | timetable

Rate curve for projecting floating cash flows, specified as the comma-separated pair consisting of 'ProjectionCurve' and a scalar ratecurve object or an NINST-by-1 vector of ratecurve objects. You must create this object using ratecurve.

Data Types: object

Lag in rate setting, specified as the comma-separated pair consisting of 'ResetOffset' and a scalar numeric or an NINST-by-1 numeric vector.

Data Types: double

Latest floating rate for the FloatBond object, specified as the comma-separated pair consisting of 'LatestFloatingRate' and a scalar decimal or an NINST-by-1 vector of decimals.

Data Types: double

Flag to adjust cash flows based on actual period day count, specified as the comma-separated pair consisting of 'DaycountAdjustedCashFlow' and a scalar logical or an NINST-by-1 vector of logicals with values of true or false.

Data Types: logical

Business day conventions, specified as the comma-separated pair consisting of 'BusinessDayConvention' and a scalar string or character vector or an NINST-by-1 cell array of character vectors or string array. 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 the comma-separated pair consisting of '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));
FloatBondObj = fininstrument("floatbond",'Spread',100,'Maturity',datetime(2025,12,15),'Holidays',H)

To support existing code, FloatBond 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 the comma-separated pair consisting of 'EndMonthRule' and a scalar logical or an NINST-by-1 vector of logicals with values of true or false.

  • 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

Bond issue date, specified as the comma-separated pair consisting of 'IssueDate' and a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

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

If you use date character vectors or strings, the format must be recognizable by datetime because the IssueDate property is stored as a datetime.

Irregular first coupon date, specified as the comma-separated pair consisting of 'FirstCouponDate' and a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

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

When FirstCouponDate and LastCouponDate are both specified, FirstCouponDate takes precedence in determining the coupon payment structure. If you do not specify FirstCouponDate, the cash flow payment dates are determined from other inputs.

If you use date character vectors or strings, the format must be recognizable by datetime because the FirstCouponDate property is stored as a datetime.

Irregular last coupon date, specified as the comma-separated pair consisting of 'LastCouponDate' and a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

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

If you specify LastCouponDate but not FirstCouponDate, LastCouponDate determines the coupon structure of the bond. The coupon structure of a bond is truncated at LastCouponDate, regardless of where it falls, and is followed only by the bond's maturity cash flow date. If you do not specify LastCouponDate, the cash flow payment dates are determined from other inputs.

If you use date character vectors or strings, the format must be recognizable by datetime because the LastCouponDate property is stored as a datetime.

Forward starting date of payments, specified as the comma-separated pair consisting of 'StartDate' and a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

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

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

User-defined name for one of more instruments, specified as the comma-separated pair consisting of '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

Number of basis points over the reference rate, returned as a scalar nonnegative numeric or an NINST-by-1 nonnegative numeric vector.

Data Types: double

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

Data Types: datetime

Coupons per year, returned as a scalar integer or an NINST-by-1 vector of integers.

Data Types: double

Day count basis, returned as a scalar integer or an NINST-by-1 vector of integers.

Data Types: double

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

Data Types: timetable | double

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

Data Types: object

Lag in rate setting, returned as a scalar numeric or an NINST-by-1 numeric vector.

Data Types: double

Latest floating rate for FloatBond, returned as a scalar decimal or an NINST-by-1 vector of decimals.

Data Types: double

Flag to adjust cash flows based on actual period day count, returned as scalar logical or an NINST-by-1 vector of logicals with values of true or false.

Data Types: logical

Business day conventions, returned as a scalar string or an NINST-by-1 string array.

Data Types: 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 a scalar logical or an NINST-by-1 vector of logical values.

Data Types: logical

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

Data Types: datetime

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

Data Types: datetime

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

Data Types: datetime

Forward starting date of 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 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

Examples

collapse all

This example shows the workflow to price a vanilla FloatBond instrument when you use a ratecurve and a Discount pricing method.

Create FloatBond Instrument Object

Use fininstrument to create a vanilla FloatBond instrument object.

FloatB = fininstrument("FloatBond",'Maturity',datetime(2022,9,15),'Spread',0.025,'Reset',2,'Basis',1,'Principal',100,'EndMonthRule',false,'Name',"float_bond_instrument")
FloatB = 
  FloatBond with properties:

                      Spread: 0.0250
             ProjectionCurve: [0x0 ratecurve]
                 ResetOffset: 0
                       Reset: 2
                       Basis: 1
                EndMonthRule: 0
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
          LatestFloatingRate: NaN
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 15-Sep-2022
                        Name: "float_bond_instrument"

Create ratecurve Object

Create a ratecurve object using ratecurve.

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

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 FloatBond Instrument

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

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

       Results: [1x2 table]
    PricerData: []

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

    109.83    0.0021981

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

Create FloatBond Instrument Object

Use fininstrument to create a vanilla FloatBond instrument object for three Float Bond instruments.

FloatB = fininstrument("FloatBond",'Maturity',datetime([2022,9,15 ; 2022,9,15 ; 2022,9,15]),'Spread',0.025,'Reset',2,'Basis',1,'Principal',[100 ; 200 ; 300],'EndMonthRule',false,'Name',"float_bond_instrument")
FloatB=3×1 FloatBond array with properties:
    Spread
    ProjectionCurve
    ResetOffset
    Reset
    Basis
    EndMonthRule
    Principal
    DaycountAdjustedCashFlow
    BusinessDayConvention
    LatestFloatingRate
    Holidays
    IssueDate
    FirstCouponDate
    LastCouponDate
    StartDate
    Maturity
    Name

Create ratecurve Object

Create a ratecurve object using ratecurve.

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

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 FloatBond Instruments

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

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

  109.8322
  219.6644
  329.4965

outPR=1×3 priceresult array with properties:
    Results
    PricerData

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

    109.83    0.0021981

ans=1×2 table
    Price       DV01   
    ______    _________

    219.66    0.0043961

ans=1×2 table
    Price      DV01   
    _____    _________

    329.5    0.0065942

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

Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2018,1,1);
ZeroTimes = calyears(1:10)';
ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]';
ZeroDates = Settle + ZeroTimes;
Compounding = 1;
ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates, "Compounding",Compounding);

Create FloatBond Instrument Object

Use fininstrument to create an amortizing FloatBond instrument object.

Maturity = datetime(2024,1,1);
Spread = 0.02;
Reset = 1;
ADates = datetime([2020,1,1 ; 2024,1,1]);
APrincipal = [100; 80];
Principal = timetable(ADates,APrincipal);
Floatamort = fininstrument("FloatBond",'Maturity',Maturity,'Spread',Spread,'Reset',Reset,'ProjectionCurve',ZeroCurve,'Principal',Principal)
Floatamort = 
  FloatBond with properties:

                      Spread: 0.0200
             ProjectionCurve: [1x1 ratecurve]
                 ResetOffset: 0
                       Reset: 1
                       Basis: 0
                EndMonthRule: 1
                   Principal: [2x1 timetable]
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
          LatestFloatingRate: NaN
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 01-Jan-2024
                        Name: ""

Create Discount Pricer Object

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

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

    DiscountCurve: [1x1 ratecurve]

Price FloatBond Instrument

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

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

       Results: [1x2 table]
    PricerData: []

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

    110.11    0.0033187

This example shows the workflow to price a FloatBond instrument when using a HullWhite model and an IRMonteCarlo pricing method.

Create FloatBond Instrument Object

Use fininstrument to create a FloatBond instrument object.

FloatB = fininstrument("FloatBond",'Maturity',datetime(2022,9,15),'Spread',0.025,'Reset',2,'Basis',1,'Principal',100,'EndMonthRule',false,'Name',"float_bond_instrument")
FloatB = 
  FloatBond with properties:

                      Spread: 0.0250
             ProjectionCurve: [0x0 ratecurve]
                 ResetOffset: 0
                       Reset: 2
                       Basis: 1
                EndMonthRule: 0
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
          LatestFloatingRate: NaN
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 15-Sep-2022
                        Name: "float_bond_instrument"

Create HullWhite Model Object

Use finmodel to create a HullWhite model object.

HullWhiteModel = finmodel("HullWhite",'Alpha',0.32,'Sigma',0.49)
HullWhiteModel = 
  HullWhite with properties:

    Alpha: 0.3200
    Sigma: 0.4900

Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2019,1,1);
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: 01-Jan-2019
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create IRMonteCarlo Pricer Object

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

outPricer = finpricer("IRMonteCarlo",'Model',HullWhiteModel,'DiscountCurve',myRC,'SimulationDates',ZeroDates)
outPricer = 
  HWMonteCarlo with properties:

          NumTrials: 1000
      RandomNumbers: []
      DiscountCurve: [1x1 ratecurve]
    SimulationDates: [01-Jul-2019    01-Jan-2020    01-Jan-2021    01-Jan-2022    01-Jan-2023    01-Jan-2024    01-Jan-2026    01-Jan-2029    01-Jan-2039    01-Jan-2049]
              Model: [1x1 finmodel.HullWhite]

Price FloatBond Instrument

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

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

       Results: [1x4 table]
    PricerData: [1x1 struct]

outPR.Results
ans=1×4 table
    Price      Delta     Gamma     Vega
    ______    _______    ______    ____

    109.12    -19.033    50.224     0  

This example shows the workflow to price a vanilla FloatBond instrument when using a HullWhite model and an IRTree pricing method.

Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2018,1,1);
ZeroTimes = calyears(1:10)';
ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]';
ZeroDates = Settle + ZeroTimes;
Compounding = 1;
ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates, "Compounding",Compounding);

Create FloatBond Instrument Object

Use fininstrument to create a vanilla FloatdBond instrument object.

Spread = 0.03;
Reset = 1;
Maturity = datetime(2024,1,1);
Period = 1;
Float = fininstrument("FloatBond",'Maturity',Maturity,'Spread',Spread,'Reset',Reset,'ProjectionCurve',ZeroCurve)
Float = 
  FloatBond with properties:

                      Spread: 0.0300
             ProjectionCurve: [1x1 ratecurve]
                 ResetOffset: 0
                       Reset: 1
                       Basis: 0
                EndMonthRule: 1
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
          LatestFloatingRate: NaN
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 01-Jan-2024
                        Name: ""

Create HullWhite Model Object

Use finmodel to create a HullWhite model object.

VolCurve = 0.01;
AlphaCurve = 0.1;

HWModel = finmodel("HullWhite",'alpha',AlphaCurve,'sigma',VolCurve);

Create IRTree Pricer Object

Use finpricer to create an IRTree pricer object and use the ratecurve object with the 'DiscountCurve' name-value pair argument.

HWTreePricer = finpricer("IRTree",'Model',HWModel,'DiscountCurve',ZeroCurve,'TreeDates',ZeroDates)
HWTreePricer = 
  HWBKTree with properties:

             Tree: [1x1 struct]
        TreeDates: [10x1 datetime]
            Model: [1x1 finmodel.HullWhite]
    DiscountCurve: [1x1 ratecurve]

Price FloatBond Instrument

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

[Price, outPR] = price(HWTreePricer,Float,["all"])
Price = 
117.4686
outPR = 
  priceresult with properties:

       Results: [1x4 table]
    PricerData: [1x1 struct]

outPR.Results
ans=1×4 table
    Price      Delta     Gamma     Vega
    ______    _______    ______    ____

    117.47    -60.007    315.09     0  

This example shows the workflow to price a FloatBond instrument when you use a CoxIngersollRoss model and an IRTree pricing method.

Create FloatBond Instrument Object

Use fininstrument to create a FloatBond instrument object.

Maturity = datetime(2027,1,1); 
Spread = 0.0020;
Reset = 1;
FloatBond = fininstrument("FloatBond",Maturity=Maturity,Spread=Spread,Reset=Reset,Name="FloatBond_inst")
FloatBond = 
  FloatBond with properties:

                      Spread: 0.0020
             ProjectionCurve: [0x0 ratecurve]
                 ResetOffset: 0
                       Reset: 1
                       Basis: 0
                EndMonthRule: 1
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
          LatestFloatingRate: NaN
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 01-Jan-2027
                        Name: "FloatBond_inst"

Create CoxIngersollRoss Model Object

Use finmodel to create a CoxIngersollRoss model object.

alpha = 0.03; 
theta = 0.02; 
sigma = 0.1; 
CIRModel = finmodel("CoxIngersollRoss",Sigma=sigma,Alpha=alpha,Theta=theta)
CIRModel = 
  CoxIngersollRoss with properties:

    Sigma: 0.1000
    Alpha: 0.0300
    Theta: 0.0200

Create ratecurve Object

Create a ratecurve object using ratecurve.

Times= [calyears([1 2 3 4 ])]';
Settle = datetime(2023,1,1);
ZRates = [0.035; 0.042147; 0.047345; 0.052707]';
ZDates = Settle + Times;
Compounding = -1; 
Basis = 1;
ZeroCurve = ratecurve("zero",Settle,ZDates,ZRates,Compounding = Compounding, Basis = Basis);

Create IRTree Pricer Object

Use finpricer to create an IRTree pricer object for the CoxIngersollRoss model and use the ratecurve object for the 'DiscountCurve' name-value argument.

CIRPricer = finpricer("irtree",Model=CIRModel,DiscountCurve=ZeroCurve,Maturity=ZDates(end),NumPeriods=length(ZDates))
CIRPricer = 
  CIRTree with properties:

             Tree: [1x1 struct]
        TreeDates: [4x1 datetime]
            Model: [1x1 finmodel.CoxIngersollRoss]
    DiscountCurve: [1x1 ratecurve]

Price FloatBond Instrument

Use price to compute the price for the FloatBond instrument.

[Price,outPR] = price(CIRPricer,FloatBond,"all")
Price = 
100.7125
outPR = 
  priceresult with properties:

       Results: [1x4 table]
    PricerData: [1x1 struct]

outPR.Results
ans=1×4 table
    Price      Delta     Gamma        Vega   
    ______    _______    ______    __________

    100.71    -1.7293    5.0818    2.8422e-10

More About

expand all

Version History

Introduced in R2020a

expand all