bondDuration
Syntax
bondDuration(settlement, maturity, coupon, yield, [frequency], [basis=1],
[bondType=0])
Arguments
settlement is a scalar or vector of DATE type, indicating the marketable security's settlement date. The settlement date is the date after the issue date when the security is traded to the buyer.
maturity is a scalar or vector of DATE type of the same length as settlement, indicating the marketable security's maturity date. The maturity date is the date when the security expires.
coupon is a numeric scalar or vector indicating the annual coupon rate of the marketable security.
yield is a numeric scalar or vector indicating the annual yield of the marketable security.
frequency (optional) is an INT scalar/vector indicating the number of payments, or a DURATION scalar/vector indicating payment frequency. This parameter is required when bondTypeis 0 or unspecified. It can be:
- 1/1y: Annual payments
- 2/6M: Semi-annual payments
- 4/3M: Quarterly payments
- 12/1M: Monthly payments
basis (optional) is an INT/STRING scalar or vector indicating the day count basis to use. It can be:
- 0/"Thirty360US": US (NASD) 30/360
- 1/"ActualActual": actual/actual
- 2/"Actual360": actual/360
- 3/"Actual365": actual/365
- 4/"Thirty360EU": European 30/360
bondType (optional) is an INT/STRING scalar or vector indicating the bond type. It can be:
- 0/"FixedRate" (default): Fixed-rate bond, where interest is paid periodically (quarterly, semi-annually, or annually) based on the coupon rate.
- 1/"Discount": Discount bond, where no interest is paid, and the bond is issued at a discount. FV at maturity = face value.
- 2/"ZeroCoupon": Zero-coupon bond, where interest and face value are paid at maturity. FV at maturity = face value + interest.
- 0/"FixedRate" (default): Fixed-rate bond, where interest is paid periodically (quarterly, semi-annually, or annually) based on the coupon rate.
- 1/"Discount": Discount bond, where no interest is paid, and the bond is issued at a discount. FV at maturity = face value.
- 2/"ZeroCoupon": Zero-coupon bond, where interest and face value are paid at maturity. FV at maturity = face value + interest.
Note: Scalar inputs will be automatically expanded to match the length of other vector inputs. All vector inputs must be of equal length.
Details
bondDuration
returns the Macaulay duration for an assumed par value
of 100. Duration is defined as the weighted average of the present value of cash
flows, and serves as a measure of a bond price's response to changes in yield.
Return type: Scalar or vector of type DOUBLE.
Examples
Calculate the duration of a bond purchased on January 1, 2023, with maturity on December 31, 2030. The bond has an annual coupon rate of 0.05, an expected yield of 0.06, an annual interest payment frequency, and uses the actual/actual day count basis.
bondDuration(settlement=2023.01.01, maturity=2030.12.31, coupon=0.05, yield=0.06, frequency=1, basis=1)
// output
6.737695071685634