Main Content

FixedBondOption

FixedBondOption instrument object

Since R2020a

Description

Create and price a FixedBondOption instrument object for one or more Fixed Bond Option instruments using this workflow:

  1. Use fininstrument to create a FixedBondOption instrument object for one or more Fixed Bond Option instruments.

  2. Use finmodel to specify a HullWhite, BlackKarasinski, BlackDermanToy, BraceGatarekMusiela, SABRBraceGatarekMusiela, CoxIngersollRoss, or LinearGaussian2F model for the FixedBondOption instrument object.

  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 FixedBondOption instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

FixedBondOptionObj = fininstrument(InstrumentType,'Strike',strike_value,'ExerciseDate',exercise_date,'Bond',bond_obj) creates a FixedBondOption object for one or more Fixed Bond Option instruments by specifying InstrumentType and sets the properties for the required name-value pair arguments Strike, ExerciseDate, and Bond.

The FixedBondOption instrument supports a European or American option. For more information, see More About.

example

FixedBondOptionObj = fininstrument(___,Name,Value) sets optional properties using additional name-value pairs in addition to the required arguments in the previous syntax. For example, FixedBondOptionObj = fininstrument("FixedBondOption",'Strike',100,'ExerciseDate',datetime(2019,1,30),'Bond',bond_obj,'OptionType','put','ExerciseStyle',"American",'Name',"fixed_bond_option") creates a FixedBondOption instrument with a strike of 100 and an American exercise. You can specify multiple name-value pair arguments.

example

Input Arguments

expand all

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

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: FixedBondOptionObj = fininstrument("FixedBondOption",'Strike',100,'ExerciseDate',datetime(2019,1,30),'Bond',bond_obj,'OptionType','put','ExerciseStyle',"American",'Name',"fixed_bond_option")

Required FixedBondOption Name-Value Pair Arguments

expand all

Option strike value, specified as the comma-separated pair consisting of 'Strike' and a scalar nonnegative numeric or an NINST-by-1 nonnegative numeric vector.

Data Types: double

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

  • For a European option, there is only one ExerciseDate on the option expiry date.

  • For a Bermudan option, there is a 1-by-NSTRIKES vector of exercise dates.

  • For an American option, the option can be exercised between Settle of the ratecurve and the single listed ExerciseDate.

To support existing code, FixedBondOption 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 ExerciseDate property is stored as a datetime.

Data Types: double | char | string | datetime

Underlying FixedBond instrument, specified as the comma-separated pair consisting of 'Bond' and a scalar FixedBond object or an NINST-by-1 vector of FixedBond objects.

Data Types: object

Optional FixedBondOption Name-Value Pair Arguments

expand all

Option type, specified as the comma-separated pair consisting of 'OptionType' 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

Option exercise style, specified as the comma-separated pair consisting of 'ExerciseStyle' and a scalar string or character vector or an NINST-by-1 cell array of character vectors or string array with values of "European", "American", or "Bermudan".

Data Types: string | cell | char

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

Option strike value, returned as a scalar nonnegative numeric or an NINST-by-1 numeric vector of nonnegative values.

Data Types: double

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

Data Types: datetime

Option type, returned as a scalar string or an NINST-by-1 string array with values of "call" or "put".

Data Types: string

Option exercise style, returned as a scalar string or an NINST-by-1 string array with values of "European" or "American".

Data Types: string

Underlying FixedBond instrument, returned as a scalar FixedBond object or an NINST-by-1 vector of FixedBond objects.

Data Types: object

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

Data Types: string

Object Functions

setExercisePolicySet exercise policy for FixedBondOption, FloatBondOption, or Vanilla instrument

Examples

collapse all

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

Create FixedBond Instrument Object

Use fininstrument to create a FixedBond instrument object as the underlying bond.

BondInst = fininstrument("FixedBond",'Maturity',datetime(2029,9,15),'CouponRate',.021,'Period',1,'Name',"bond_instrument")
BondInst = 
  FixedBond with properties:

                  CouponRate: 0.0210
                      Period: 1
                       Basis: 0
                EndMonthRule: 1
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 15-Sep-2029
                        Name: "bond_instrument"

Create FixedBondOption Instrument Objects

Use fininstrument to create three callable FixedBondOption instrument objects with European, American, and Bermudan exercise.

FixedBOptionEuro = fininstrument("FixedBondOption",'ExerciseDate',datetime(2025,9,15),'Strike',98,'Bond',BondInst,'OptionType',"call",'ExerciseStyle',"european",'Name',"fixed_bond_option_european")
FixedBOptionEuro = 
  FixedBondOption with properties:

       OptionType: "call"
    ExerciseStyle: "european"
     ExerciseDate: 15-Sep-2025
           Strike: 98
             Bond: [1x1 fininstrument.FixedBond]
             Name: "fixed_bond_option_european"

FixedBOptionAmerican = fininstrument("FixedBondOption",'ExerciseDate',datetime(2025,9,15),'Strike',98,'Bond',BondInst,'OptionType',"call",'ExerciseStyle',"american",'Name',"fixed_bond_option_american")
FixedBOptionAmerican = 
  FixedBondOption with properties:

       OptionType: "call"
    ExerciseStyle: "american"
     ExerciseDate: 15-Sep-2025
           Strike: 98
             Bond: [1x1 fininstrument.FixedBond]
             Name: "fixed_bond_option_american"

FixedBOptionBermudan = fininstrument("FixedBondOption",'ExerciseDate',[datetime(2025,9,15) , datetime(2025,11,15)],'Strike',[98,1000],'Bond',BondInst,'OptionType',"call",'ExerciseStyle',"bermudan",'Name',"fixed_bond_option_bermudan")
FixedBOptionBermudan = 
  FixedBondOption with properties:

       OptionType: "call"
    ExerciseStyle: "bermudan"
     ExerciseDate: [15-Sep-2025    15-Nov-2025]
           Strike: [98 1000]
             Bond: [1x1 fininstrument.FixedBond]
             Name: "fixed_bond_option_bermudan"

Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2019,9,15);
Type = 'zero';
ZeroTimes = [calyears([1:10])]';
ZeroRates = [0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307 0.0310]';
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 a HullWhite Model Object

Use finmodel to create a HullWhite model object.

HullWhiteModel = finmodel("HullWhite",'Alpha',0.01,'Sigma',0.05)
HullWhiteModel = 
  HullWhite with properties:

    Alpha: 0.0100
    Sigma: 0.0500

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',HullWhiteModel,'DiscountCurve',myRC,'TreeDates',ZeroDates)
HWTreePricer = 
  HWBKTree with properties:

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

HWTreePricer.Tree
ans = struct with fields:
        tObs: [0 1 1.9973 2.9945 3.9918 4.9918 5.9891 6.9863 7.9836 8.9836]
        dObs: [15-Sep-2019    15-Sep-2020    15-Sep-2021    15-Sep-2022    15-Sep-2023    15-Sep-2024    15-Sep-2025    15-Sep-2026    15-Sep-2027    15-Sep-2028]
      CFlowT: {[10x1 double]  [9x1 double]  [8x1 double]  [7x1 double]  [6x1 double]  [5x1 double]  [4x1 double]  [3x1 double]  [2x1 double]  [9.9809]}
       Probs: {[3x1 double]  [3x3 double]  [3x5 double]  [3x7 double]  [3x9 double]  [3x11 double]  [3x13 double]  [3x15 double]  [3x17 double]}
     Connect: {[2]  [2 3 4]  [2 3 4 5 6]  [2 3 4 5 6 7 8]  [2 3 4 5 6 7 8 9 10]  [2 3 4 5 6 7 8 9 10 11 12]  [2 3 4 5 6 7 8 9 10 11 12 13 14]  [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]  [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18]}
     FwdTree: {1x10 cell}
    RateTree: {1x10 cell}

Price FixedBondOption Instruments

Use price to compute the price and sensitivities for the two FixedBondOption instruments.

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

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

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

    10.757    -178.78    2207.3    308.87

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

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

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

    19.298    -459.06    4977.1    437.32

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

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

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

    10.757    -178.78    2207.3    308.87

This example shows the workflow to price multiple FixedBondOption instruments when you use a HullWhite model and an IRTree pricing method.

Create FixedBond Instrument Object

Use fininstrument to create a FixedBond instrument object as the underlying bond.

BondInst = fininstrument("FixedBond",'Maturity',datetime(2029,9,15),'CouponRate',.021,'Period',1,'Name',"bond_instrument")
BondInst = 
  FixedBond with properties:

                  CouponRate: 0.0210
                      Period: 1
                       Basis: 0
                EndMonthRule: 1
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 15-Sep-2029
                        Name: "bond_instrument"

Create FixedBondOption Instrument Objects

Use fininstrument to create a FixedBondOption instrument object with European exercise for three Fixed Bond Option instruments.

FixedBOptionEuro = fininstrument("FixedBondOption",'ExerciseDate',datetime([2025,9,15 ; 2025,10,15 ; 2025,11,15]),'Strike',[98 ; 100 ; 102],'Bond',BondInst,'OptionType',"call",'ExerciseStyle',"european",'Name',"fixed_bond_option_european")
FixedBOptionEuro=3×1 FixedBondOption array with properties:
    OptionType
    ExerciseStyle
    ExerciseDate
    Strike
    Bond
    Name

Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2019,9,15);
Type = 'zero';
ZeroTimes = [calyears([1:10])]';
ZeroRates = [0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307 0.0310]';
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 a HullWhite Model Object

Use finmodel to create a HullWhite model object.

HullWhiteModel = finmodel("HullWhite",'Alpha',0.01,'Sigma',0.05)
HullWhiteModel = 
  HullWhite with properties:

    Alpha: 0.0100
    Sigma: 0.0500

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',HullWhiteModel,'DiscountCurve',myRC,'TreeDates',ZeroDates)
HWTreePricer = 
  HWBKTree with properties:

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

HWTreePricer.Tree
ans = struct with fields:
        tObs: [0 1 1.9973 2.9945 3.9918 4.9918 5.9891 6.9863 7.9836 8.9836]
        dObs: [15-Sep-2019    15-Sep-2020    15-Sep-2021    15-Sep-2022    15-Sep-2023    15-Sep-2024    15-Sep-2025    15-Sep-2026    15-Sep-2027    15-Sep-2028]
      CFlowT: {[10x1 double]  [9x1 double]  [8x1 double]  [7x1 double]  [6x1 double]  [5x1 double]  [4x1 double]  [3x1 double]  [2x1 double]  [9.9809]}
       Probs: {[3x1 double]  [3x3 double]  [3x5 double]  [3x7 double]  [3x9 double]  [3x11 double]  [3x13 double]  [3x15 double]  [3x17 double]}
     Connect: {[2]  [2 3 4]  [2 3 4 5 6]  [2 3 4 5 6 7 8]  [2 3 4 5 6 7 8 9 10]  [2 3 4 5 6 7 8 9 10 11 12]  [2 3 4 5 6 7 8 9 10 11 12 13 14]  [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]  [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18]}
     FwdTree: {1x10 cell}
    RateTree: {1x10 cell}

Price FixedBondOption Instruments

Use price to compute the prices and sensitivities for the FixedBondOption instruments.

[Price, outPR] = price(HWTreePricer,FixedBOptionEuro,["all"])
Price = 3×1

   10.7571
   10.2111
    9.6508

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

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

    10.757    -178.78    2207.3    308.87

ans=1×4 table
    Price      Delta     Gamma      Vega 
    ______    _______    ______    ______

    10.211    -173.94    2168.8    300.36

ans=1×4 table
    Price      Delta     Gamma      Vega 
    ______    _______    ______    ______

    9.6508    -168.87    2127.8    291.34

This example shows the workflow to price a FixedBondOption instrument on a stepped FixedBond instrument when you use a HullWhite model and an IRTree pricing method.

Create Stepped FixedBond Instrument Object

Use fininstrument to create a stepped FixedBond instrument object as the underlying bond.

Maturity = datetime(2027,1,1);
Period = 1;
CDates = datetime([2022,1,1 ; 2027,1,1]);
CRates = [.022; .027];
CouponRate = timetable(CDates,CRates);

SBond = fininstrument("FixedBond",'Maturity',Maturity,'CouponRate',CouponRate,'Period',Period,'Name',"stepped_bond_instrument") 
SBond = 
  FixedBond with properties:

                  CouponRate: [2x1 timetable]
                      Period: 1
                       Basis: 0
                EndMonthRule: 1
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 01-Jan-2027
                        Name: "stepped_bond_instrument"

Create FixedBondOption Instrument Object

Use fininstrument to create a FixedBondOption instrument object with European exercise.

FixedBOption = fininstrument("FixedBondOption",'ExerciseDate',datetime(2026,1,1),'Strike',90,'Bond',SBond,'OptionType',"call",'ExerciseStyle',"european",'Name',"fixed_bond_option_european")
FixedBOption = 
  FixedBondOption with properties:

       OptionType: "call"
    ExerciseStyle: "european"
     ExerciseDate: 01-Jan-2026
           Strike: 90
             Bond: [1x1 fininstrument.FixedBond]
             Name: "fixed_bond_option_european"

Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2018,1,1);
ZeroTimes = calyears(1:10)';
ZeroRates = [0.0055 0.0063 0.0071 0.0083 0.0099 0.0131 0.0178 0.0262 0.0343 0.0387]';
ZeroDates = Settle + ZeroTimes;
Compounding = 1;
ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates, "Compounding",Compounding);

Create HullWhite Model Object

Use finmodel to create a HullWhite model object.

VolCurve = 0.15;
AlphaCurve = 0.03;

HWModel = finmodel("HullWhite",'Alpha',AlphaCurve,'Sigma',VolCurve)
HWModel = 
  HullWhite with properties:

    Alpha: 0.0300
    Sigma: 0.1500

Create IRTree Pricer Object

Use finpricer to create an IRTree pricer object and use the ratecurve object for 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]

HWTreePricer.Tree
ans = struct with fields:
        tObs: [0 1 2 3.0027 4.0027 5.0027 6.0027 7.0055 8.0055 9.0055]
        dObs: [01-Jan-2018    01-Jan-2019    01-Jan-2020    01-Jan-2021    01-Jan-2022    01-Jan-2023    01-Jan-2024    01-Jan-2025    01-Jan-2026    01-Jan-2027]
      CFlowT: {[10x1 double]  [9x1 double]  [8x1 double]  [7x1 double]  [6x1 double]  [5x1 double]  [4x1 double]  [3x1 double]  [2x1 double]  [10.0055]}
       Probs: {[3x1 double]  [3x3 double]  [3x5 double]  [3x7 double]  [3x9 double]  [3x11 double]  [3x13 double]  [3x15 double]  [3x17 double]}
     Connect: {[2]  [2 3 4]  [2 3 4 5 6]  [2 3 4 5 6 7 8]  [2 3 4 5 6 7 8 9 10]  [2 3 4 5 6 7 8 9 10 11 12]  [2 3 4 5 6 7 8 9 10 11 12 13 14]  [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]  [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18]}
     FwdTree: {1x10 cell}
    RateTree: {1x10 cell}

Price FixedBondOption Instrument

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

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

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

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

    12.272    -130.1    1438.4    100.91

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

Create FixedBond Instrument Object

Use fininstrument to create a FixedBond instrument object as the underlying bond.

BondInst = fininstrument("FixedBond",'Maturity',datetime(2022,9,15),'CouponRate',.021,'Period',1,'Name',"bond_instrument")
BondInst = 
  FixedBond with properties:

                  CouponRate: 0.0210
                      Period: 1
                       Basis: 0
                EndMonthRule: 1
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 15-Sep-2022
                        Name: "bond_instrument"

Create FixedBondOption Instrument Object

Use fininstrument to create a FixedBondOption instrument object.

FixedBOptionEuro = fininstrument("FixedBondOption",'ExerciseDate',datetime(2020,3,15),'Strike',98,'Bond',BondInst,'OptionType',"call",'ExerciseStyle',"european",'Name',"fixed_bond_option_european")
FixedBOptionEuro = 
  FixedBondOption with properties:

       OptionType: "call"
    ExerciseStyle: "european"
     ExerciseDate: 15-Mar-2020
           Strike: 98
             Bond: [1x1 fininstrument.FixedBond]
             Name: "fixed_bond_option_european"

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',datetime(2019,3,15)+calmonths(0:6:48)')
outPricer = 
  HWMonteCarlo with properties:

          NumTrials: 1000
      RandomNumbers: []
      DiscountCurve: [1x1 ratecurve]
    SimulationDates: [15-Mar-2019    15-Sep-2019    15-Mar-2020    15-Sep-2020    15-Mar-2021    15-Sep-2021    15-Mar-2022    15-Sep-2022    15-Mar-2023]
              Model: [1x1 finmodel.HullWhite]

Price FixedBondOption Instrument

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

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

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

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

    24.075    -166.42    1456.2    20.329

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

Create FixedBond Instrument Object

Use fininstrument to first create a FixedBond instrument object.

Maturity = datetime(2027,1,1); 
Period = 1;
CouponRate = 0.035;
FixedBond = fininstrument("FixedBond",Maturity=Maturity,CouponRate=CouponRate,Period=Period,Name="FixedBond_inst")
FixedBond = 
  FixedBond with properties:

                  CouponRate: 0.0350
                      Period: 1
                       Basis: 0
                EndMonthRule: 1
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 01-Jan-2027
                        Name: "FixedBond_inst"

Create FixedBondOption Instrument Object

Then use fininstrument to create a FixedBondOption instrument object.

Strike = 96;
OptionType = 'call';
ExerciseDate = datetime(2025,1,1);
FixedBOption = fininstrument("FixedBondOption",ExerciseDate=ExerciseDate,Strike=Strike,Bond=FixedBond,OptionType=OptionType,Name="FixedBondOption_inst")
FixedBOption = 
  FixedBondOption with properties:

       OptionType: "call"
    ExerciseStyle: "european"
     ExerciseDate: 01-Jan-2025
           Strike: 96
             Bond: [1x1 fininstrument.FixedBond]
             Name: "FixedBondOption_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 FixedBondOption Instrument

Use price to compute the price for the FixedBondOption instrument.

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

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

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

    1.0251    -53.957    296.82    13.791

More About

expand all

Tips

After creating a FixedBondOption instrument object, you can use setExercisePolicy to change the size of the options. For example, if you have the following instrument:

FixedBOption = fininstrument("FixedBondOption",'ExerciseDate',datetime(2022,9,15),'Strike',98,'Bond',BondInst,'OptionType',"call",'ExerciseStyle',"European")
To modify the FixedBondOption instrument's size by changing the ExerciseStyle from "European" to "American", use setExercisePolicy:
FixedBOption = setExercisePolicy(FixedBOption,[datetime(2021,1,1) datetime(2022,1,1)],100,'American')

Version History

Introduced in R2020a

expand all