bondCashflow
Syntax
bondCashflow(settlement, maturity, coupon, [frequency], [basis=1],
[bondType=0])
Details
bondCashflow
calculates the cash flow for a bond with a face value
of 100. Supports fixed-rate bonds, zero-coupon bonds, and discount bonds.
Return value: Vector or array vector of DOUBLE type.
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, 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.
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 bondType is 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. Defaults to 1. 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.
Examples
Calculate the cash flows for two fixed-rate bonds purchased on September 28, 2022, with maturity dates of September 28, 2023, and September 28, 2024, respectively. Both have an annual coupon rate of 0.025, paid quarterly, with an actual/actual day count basis.
settlement = 2022.09.28
maturity = [2023.09.28, 2024.09.28]
coupon = 0.025
frequency = 4
basis = 1
bondCashflow(settlement, maturity, coupon, frequency, basis);
/* output
[[0.625,0.625,0.625,100.625],[0.625,0.625,0.625,0.625,0.625,0.625,0.625,100.625]]
*/