Main Content

optembndbyhw

Price bonds with embedded options by Hull-White interest-rate tree

Description

[Price,PriceTree] = optembndbyhw(HWTree,CouponRate,Settle,Maturity,OptSpec,Strike,ExerciseDates) calculates price for bonds with embedded options from a Hull-White interest-rate tree and returns exercise probabilities in PriceTree.

optembndbyhw computes prices of vanilla bonds with embedded options, stepped coupon bonds with embedded options, amortizing bonds with embedded options, and sinking fund bonds with call embedded option. For more information, see More About.

Note

Alternatively, you can use the OptionEmbeddedFixedBond object to price embedded fixed-rate bond option instruments. For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

example

[Price,PriceTree] = optembndbyhjm(___,Name,Value) adds optional name-value pair arguments.

example

Examples

collapse all

Create a HWTree with the following data:

ZeroRates = [ 0.035;0.04;0.045];
Compounding = 1;
StartDates = [datetime(2007,1,1) ; datetime(2008,1,1) ; datetime(2009,1,1)];
EndDates   = [datetime(2008,1,1) ; datetime(2009,1,1) ; datetime(2010,1,1)];
ValuationDate = datetime(2007,1,1);

Create a RateSpec.

RateSpec = intenvset('Rates', ZeroRates, 'StartDates', ValuationDate, 'EndDates', ...
EndDates, 'Compounding', Compounding, 'ValuationDate', ValuationDate)
RateSpec = struct with fields:
           FinObj: 'RateSpec'
      Compounding: 1
             Disc: [3×1 double]
            Rates: [3×1 double]
         EndTimes: [3×1 double]
       StartTimes: [3×1 double]
         EndDates: [3×1 double]
       StartDates: 733043
    ValuationDate: 733043
            Basis: 0
     EndMonthRule: 1

Create a VolSpec.

VolDates = [datetime(2008,1,1) ; datetime(2009,1,1) ; datetime(2010,1,1)];
VolCurve = 0.01;
AlphaDates = datetime(2010,1,1);
AlphaCurve = 0.1;
HWVolSpec = hwvolspec(ValuationDate, VolDates, VolCurve, AlphaDates, AlphaCurve)
HWVolSpec = struct with fields:
             FinObj: 'HWVolSpec'
      ValuationDate: 733043
           VolDates: [3×1 double]
           VolCurve: [3×1 double]
         AlphaCurve: 0.1000
         AlphaDates: 734139
    VolInterpMethod: 'linear'

Create a TimeSpec.

HWTimeSpec = hwtimespec(ValuationDate, EndDates, Compounding)
HWTimeSpec = struct with fields:
           FinObj: 'HWTimeSpec'
    ValuationDate: 733043
         Maturity: [3×1 double]
      Compounding: 1
            Basis: 0
     EndMonthRule: 1

Build the HWTree.

HWTree = hwtree(HWVolSpec, RateSpec, HWTimeSpec)
HWTree = struct with fields:
      FinObj: 'HWFwdTree'
     VolSpec: [1×1 struct]
    TimeSpec: [1×1 struct]
    RateSpec: [1×1 struct]
        tObs: [0 1 2]
        dObs: [733043 733408 733774]
      CFlowT: {[3×1 double]  [2×1 double]  [3]}
       Probs: {[3×1 double]  [3×3 double]}
     Connect: {[2]  [2 3 4]}
     FwdTree: {[1.0350]  [1.0633 1.0451 1.0271]  [1.0925 1.0737 1.0553 1.0371 1.0193]}

Compute the price of an American puttable bond that pays an annual coupon of 5.25%, matures on January 1, 2010, and is puttable from January 1, 2008 to January 1, 2010.

BondSettlement = datetime(2007,1,1);
BondMaturity   = datetime(2010,1,1); 
CouponRate = 0.0525;
Period = 1;
OptSpec = 'put'; 
Strike = [100];  
ExerciseDates = [datetime(2008,1,1) datetime(2010,1,1)]; 
AmericanOpt = 1;

PricePutBondHW = optembndbyhw(HWTree, CouponRate, BondSettlement, BondMaturity,...
OptSpec, Strike, ExerciseDates,'Period', 1, 'AmericanOpt', 1)
PricePutBondHW = 
102.9127

Create a HWTree with the following data:

Rates = [0.035; 0.042147; 0.047345; 0.052707];
ValuationDate = datetime(2019,1,1);
StartDates = ValuationDate;
EndDates = [datetime(2020,1,1) ; datetime(2021,1,1) ; datetime(2022,1,1) ; datetime(2023,1,1)];
Compounding = 1;

Create a RateSpec.

RS = intenvset('ValuationDate', ValuationDate, 'StartDates', StartDates,...
'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding);

Define the callable bond instruments.

Settle = datetime(2019,1,1);
Maturity = [datetime(2022,1,1) ; datetime(2023,1,1)];
CouponRate = {{datetime(2021,1,1) .0425 ; datetime(2023,1,1) .0450}};  
OptSpec='call';
Strike= [98;95];
ExerciseDates= [datetime(2021,1,1) ; datetime(2022,1,1)];

Build the HW tree with the following data.

VolDates = [datetime(2020,1,1) ; datetime(2021,1,1) ; datetime(2022,1,1) ; datetime(2023,1,1)];
VolCurve = 0.05;
AlphaDates = datetime(2023,1,1);
AlphaCurve = 0.05;
 
 
HWVolSpec = hwvolspec(RS.ValuationDate, VolDates, VolCurve,... 
AlphaDates, AlphaCurve);
HWTimeSpec = hwtimespec(RS.ValuationDate, VolDates, Compounding);
HWT = hwtree(HWVolSpec, RS, HWTimeSpec);

Price the instruments.

[Price, PriceTree]= optembndbyhw(HWT, CouponRate,  Settle, Maturity,OptSpec, Strike,...
ExerciseDates, 'Period', 1)
Price = 2×1

   96.4131
   92.9341

PriceTree = struct with fields:
                FinObj: 'HWPriceTree'
                  tObs: [0 1 2 3 4]
                 PTree: {[2×1 double]  [2×3 double]  [2×5 double]  [2×7 double]  [2×7 double]}
              ProbTree: {[1]  [0.1667 0.6667 0.1667]  [0.0238 0.2218 0.5087 0.2218 0.0238]  [0.0029 0.0473 0.2374 0.4247 0.2374 0.0473 0.0029]  [0.0029 0.0473 0.2374 0.4247 0.2374 0.0473 0.0029]}
                ExTree: {[2×1 double]  [2×3 double]  [2×5 double]  [2×7 double]  [2×7 double]}
            ExProbTree: {[2×1 double]  [2×3 double]  [2×5 double]  [2×7 double]  [2×7 double]}
    ExProbsByTreeLevel: [2×5 double]
               Connect: {[2]  [2 3 4]  [2 3 4 5 6]}

Examine the output PriceTree.ExTree. PriceTree.ExTree contains the exercise indicator arrays. Each element of the cell array is an array containing 1's where an option is exercised and 0's where it is not.

PriceTree.ExTree{5}   
ans = 2×7

     0     0     0     0     0     0     0
     0     0     0     0     0     0     0

There is no exercise for instrument 1 or 2.

PriceTree.ExTree{4} 
ans = 2×7

     0     0     0     0     0     0     0
     0     0     0     1     1     1     1

There is no exercise for instrument 1 and instrument 2 is exercised at some nodes.

PriceTree.ExTree{3} 
ans = 2×5

     0     0     1     1     1
     0     0     0     0     0

There is the exercise for instrument 1 at some node and no exercise for instrument 2.

PriceTree.ExTree{2} 
ans = 2×3

     0     0     0
     0     0     0

There is no exercise for instrument 1 or 2.

Next view the probability of reaching each node from the root node using PriceTree.ProbTree.

PriceTree.ProbTree{2}
ans = 1×3

    0.1667    0.6667    0.1667

PriceTree.ProbTree{3}
ans = 1×5

    0.0238    0.2218    0.5087    0.2218    0.0238

PriceTree.ProbTree{4}
ans = 1×7

    0.0029    0.0473    0.2374    0.4247    0.2374    0.0473    0.0029

PriceTree.ProbTree{5}
ans = 1×7

    0.0029    0.0473    0.2374    0.4247    0.2374    0.0473    0.0029

Then view the exercise probabilities using PriceTree.ExProbTree. PriceTree.ExProbTree contains the exercise probabilities. Each element in the cell array is an array containing 0's where there is no exercise, or the probability of reaching that node where exercise happens.

PriceTree.ExProbTree{5}
ans = 2×7

     0     0     0     0     0     0     0
     0     0     0     0     0     0     0

PriceTree.ExProbTree{4}
ans = 2×7

         0         0         0         0         0         0         0
         0         0         0    0.4247    0.2374    0.0473    0.0029

PriceTree.ExProbTree{3}
ans = 2×5

         0         0    0.5087    0.2218    0.0238
         0         0         0         0         0

PriceTree.ExProbTree{2}
ans = 2×3

     0     0     0
     0     0     0

View the exercise probabilities at each tree level using PriceTree.ExProbsByTreeLevel. PriceTree.ExProbsByTreeLevel is an array with each row holding the exercise probability for a given option at each tree observation time.

PriceTree.ExProbsByTreeLevel
ans = 2×5

         0         0    0.7544         0         0
         0         0         0    0.7124         0

Price the following single stepped callable bonds using the following data: The data for the interest rate term structure is as follows:

Rates = [0.035; 0.042147; 0.047345; 0.052707];
ValuationDate = datetime(2010,1,1);
StartDates = ValuationDate;
EndDates = [datetime(2011,1,1) ; datetime(2012,1,1) ; datetime(2013,1,1); datetime(2014,1,1)];
Compounding = 1;

% Create RateSpec
RS = intenvset('ValuationDate', ValuationDate, 'StartDates', StartDates,...
'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding);

% Instrument
Settle = datetime(2010,1,1);
Maturity = [datetime(2013,1,1) ; datetime(2014,1,1)];
CouponRate = {{datetime(2012,1,1) .0425;datetime(2014,1,1) .0750}};  
OptSpec = 'call';
Strike = 100;
ExerciseDates = datetime(2012,1,1);  %Callable in two years

% Build the tree with the following data
VolDates = [datetime(2011,1,1) ; datetime(2012,1,1) ; datetime(2013,1,1) ; datetime(2014,1,1)];
VolCurve = 0.01;
AlphaDates = datetime(2014,1,1);
AlphaCurve = 0.1;


HWVolSpec = hwvolspec(RS.ValuationDate, VolDates, VolCurve,... 
AlphaDates, AlphaCurve);
HWTimeSpec = hwtimespec(RS.ValuationDate, VolDates, Compounding);
HWT = hwtree(HWVolSpec, RS, HWTimeSpec);

% The first row corresponds to the price of the callable bond with maturity
% of three years. The second row corresponds to the price of the callable 
% bond with maturity of four years.

PHW= optembndbyhw(HWT, CouponRate,  Settle, Maturity,OptSpec, Strike,...
ExerciseDates, 'Period', 1)
PHW = 2×1

  100.0326
   99.7987

A corporation issues a two year bond with a sinking fund obligation requiring the company to sink 1/3 of face value after the first year. The company has the option to buy the bonds in the market or call them at $99. The following data describes the details needed for pricing the sinking fund bond:

Rates = [0.1;0.1;0.1;0.1];
ValuationDate = datetime(2011,1,1);
StartDates = ValuationDate;
EndDates = [datetime(2012,1,1) ; datetime(2013,1,1) ; datetime(2014,1,1) ; datetime(2015,1,1)];
Compounding = 1;

% Create RateSpec
RateSpec = intenvset('ValuationDate', ValuationDate, 'StartDates',...
StartDates, 'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding);

% Build the HW tree
% The data to build the tree is as follows:
VolDates = [datetime(2012,1,1) ; datetime(2013,1,1) ; datetime(2014,1,1) ; datetime(2015,1,1)];
VolCurve = 0.01;
AlphaDates = datetime(2015,1,1);
AlphaCurve = 0.1;

HWVolSpec = hwvolspec(RateSpec.ValuationDate, VolDates, VolCurve,... 
AlphaDates, AlphaCurve);
HWTimeSpec = hwtimespec(RateSpec.ValuationDate, VolDates, Compounding);
HWT = hwtree(HWVolSpec, RateSpec, HWTimeSpec);


% Instrument
% The bond has a coupon rate of 9%, a period of one year and matures in
% 1-Jan-2013. Face decreases 1/3 after the first year.
CouponRate = 0.09;
Settle = datetime(2011,1,1);
Maturity =  datetime(2013,1,1);
Period = 1;
Face = { ...        
            {datetime(2012,1,1) 100; ...
             datetime(2013,1,1) 66.6666}; ...
        };

% Option provision
OptSpec = 'call'; 
Strike = 99;
ExerciseDates = datetime(2012,1,1);

% Price of non-sinking fund bond. 
PNSF = bondbyhw(HWT, CouponRate, Settle, Maturity, Period)
PNSF = 
98.2645

Price of the bond with the option sinking provision.

PriceSF = optembndbyhw(HWT, CouponRate, Settle, Maturity,...
OptSpec, Strike, ExerciseDates, 'Period', Period, 'Face', Face)
PriceSF = 
98.1553

This example shows how to price an amortizing callable bond and a vanilla callable bond using an HW lattice model.

Create a RateSpec.

Rates = [0.035; 0.042147; 0.047345; 0.052707];
ValuationDate = datetime(2012,1,1);
StartDates = ValuationDate;
EndDates = [datetime(2013,1,1) ; datetime(2014,1,1) ; datetime(2015,1,1) ; datetime(2016,1,1)];
Compounding = 1;
RS = intenvset('ValuationDate', ValuationDate, 'StartDates', StartDates,...
'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding);

Build a HW tree.

VolDates = [datetime(2013,1,1) ; datetime(2014,1,1) ; datetime(2015,1,1) ; datetime(2016,1,1)];
VolCurve = 0.01;
AlphaDates = datetime(2016,1,1);
AlphaCurve = 0.1;

HWVolSpec = hwvolspec(RS.ValuationDate, VolDates, VolCurve,... 
AlphaDates, AlphaCurve);
HWTimeSpec = hwtimespec(RS.ValuationDate, EndDates, Compounding);
HWT = hwtree(HWVolSpec, RS, HWTimeSpec);

Define the callable bond.

CouponRate = 0.05;
Settle = datetime(2012,1,1);
Maturity = datetime(2016,1,1);
Period = 1;
    
    Face = { 
                 {datetime(2014,1,1) 100; 
                  datetime(2015,1,1) 70;
                  datetime(2016,1,1) 50};
                 };
 
OptSpec = 'call'; 
Strike = [97 95 93];
ExerciseDates = [datetime(2014,1,1) datetime(2015,1,1) datetime(2016,1,1) ];

Price a callable amortizing bond using the HW tree.

BondType = 'amortizing';
Pcallbonds = optembndbyhw(HWT, CouponRate,  Settle, Maturity ,OptSpec, Strike,...
ExerciseDates, 'Period', 1,'Face',Face,'BondType', BondType)
Pcallbonds = 
98.6554

Input Arguments

collapse all

Interest-rate tree structure, specified by using hwtree.

Data Types: struct

Bond coupon rate, specified as an NINST-by-1 decimal annual rate or NINST-by-1 cell array, where each element is a NumDates-by-2 cell array. The first column of the NumDates-by-2 cell array is dates and the second column is associated rates. The date indicates the last day that the coupon rate is valid.

Data Types: double | cell

Settlement date for the bond option, specified as a NINST-by-1 vector using a datetime array, string array, or date character vectors.

Note

The Settle date for every bond is set to the ValuationDate of the HW tree. The bond argument Settle is ignored.

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

Maturity date, specified as an NINST-by-1 vector using a datetime array, string array, or date character vectors.

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

Definition of option, specified as a NINST-by-1 cell array of character vectors.

Data Types: char

Option strike price value, specified as a NINST-by-1 or NINST-by-NSTRIKES depending on the type of option:

  • European option — NINST-by-1 vector of strike price values.

  • Bermuda option — NINST by number of strikes (NSTRIKES) matrix of strike price values. Each row is the schedule for one option. If an option has fewer than NSTRIKES exercise opportunities, the end of the row is padded with NaNs.

  • American option — NINST-by-1 vector of strike price values for each option.

Data Types: double

Option exercise dates, specified as a NINST-by-1, NINST-by-2, or NINST-by-NSTRIKES vector using a datetime array, string array, or date character vectors, depending on the type of option:

  • For a European option, use a NINST-by-1 vector of dates. For a European option, there is only one ExerciseDates on the option expiry date.

  • For a Bermuda option, use a NINST-by-NSTRIKES vector of dates.

  • For an American option, use a NINST-by-2 vector of exercise date boundaries. The option can be exercised on any date between or including the pair of dates on that row. If only one non-NaN date is listed, or if ExerciseDates is a NINST-by-1 vector, the option can be exercised between ValuationDate of the stock tree and the single listed ExerciseDates.

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

Name-Value Arguments

collapse all

Specify 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: Price = optembndbyhw(HWTree,CouponRate,Settle,Maturity,OptSpec,Strike,ExerciseDates,'Period',1,'AmericanOp',1)

Option type, specified as the comma-separated pair consisting of 'AmericanOpt' and NINST-by-1 positive integer flags with values:

  • 0 — European/Bermuda

  • 1 — American

Data Types: double

Coupons per year, specified as the comma-separated pair consisting of 'Period' and a NINST-by-1 vector.

Data Types: double

Day-count basis, specified as the comma-separated pair consisting of 'Basis' and a NINST-by-1 vector of integers.

  • 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

End-of-month rule flag, specified as the comma-separated pair consisting of 'EndMonthRule' and a nonnegative integer using a NINST-by-1 vector. This rule applies only when Maturity is an end-of-month date for a month having 30 or fewer days.

  • 0 = Ignore rule, meaning that a bond coupon payment date is always the same numerical day of the month.

  • 1 = Set rule on, meaning that a bond coupon payment date is always the last actual day of the month.

Data Types: double

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

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

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

To support existing code, optembndbyhw 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 a FirstCouponDate, the cash flow payment dates are determined from other inputs.

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

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

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

Forward starting date of payments (the date from which a bond cash flow is considered), specified as the comma-separated pair consisting of 'StartDate' and a NINST-by-1 vector using a datetime array, string array, or date character vectors.

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

If you do not specify StartDate, the effective start date is the Settle date.

Face or par value, specified as the comma-separated pair consisting of 'Face' and a NINST-by-1 vector or a NINST-by-1 cell array where each element is a NumDates-by-2 cell array where the first column is dates and the second column is associated face value. The date indicates the last day that the face value is valid.

Note

Instruments without a Face schedule are treated as either vanilla bonds or stepped coupon bonds with embedded options.

Data Types: double

Type of underlying bond, specified as the comma-separated pair consisting of 'BondType' and a NINST-by-1 cell array of character vectors or string array specifying if the underlying is a vanilla bond, an amortizing bond, or a callable sinking fund bond. The supported types are:

  • 'vanilla' is a standard callable or puttable bond with a scalar Face value and a single coupon or stepped coupons.

  • 'callablesinking' is a bond with a schedule of Face values and a sinking fund call provision with a single or stepped coupons.

  • 'amortizing' is an amortizing callable or puttable bond with a schedule of Face values with single or stepped coupons.

Data Types: char | string

Derivatives pricing options, specified as the comma-separated pair consisting of 'Options' and a structure that is created with derivset.

Data Types: struct

Output Arguments

collapse all

Expected price of the embedded option at time 0, returned as a NINST-by-1 matrix.

Structure containing trees of vectors of instrument prices, a vector of observation times for each node, and exercise probabilities. Values are:

  • PriceTree.PTree contains the clean prices.

  • PriceTree.tObs contains the observation times.

  • PriceTree.ExTree contains the exercise indicator arrays. Each element of the cell array is an array containing 1's where an option is exercised and 0's where it isn't.

  • PriceTree.ProbTree contains the probability of reaching each node from root node.

  • PriceTree.ExProbTree contains the exercise probabilities. Each element in the cell array is an array containing 0's where there is no exercise, or the probability of reaching that node where exercise happens.

  • PriceTree.ExProbsByTreeLevel is an array with each row holding the exercise probability for a given option at each tree observation time.

More About

collapse all

Version History

Introduced in R2008a

expand all