Bond Valuation¶
This module computes the present value or the yield-to-maturity of of the expected cashflow of a bond. Also,it is possible to make a sensibility analysis for different values for the yield-to-maturity and one present value of the bond.
-
cashflows.bond.
bond
(face_value=None, coupon_rate=None, coupon_value=None, num_coupons=None, value=None, ytm=None)[source]¶ Evaluation of bond investments.
Parameters: - face_value (float) – the bond’s value-at-maturity.
- coupon_rate (float) – rate for calculate the coupon payment.
- coupon_value (float) – periodic payment.
- num_coupons (int) – number of couont payments before maturity.
- value (float, list) – present value of the bond
- ytm (float, list) – yield-to-maturity.
Returns: - value: when ytm is specified.
- ytm: when value is specified.
- None: when ytm and value are specified. Prints a sensibility table.
Return type: None, a float value, or a list of float values
When coupon_rate is defined, coupon_value is calculated automaticly.
Examples:
>>> bond(face_value=1000, coupon_value=56, num_coupons=10, ytm=5.6) 1000.0...
>>> bond(face_value=1000, coupon_rate=5.6, num_coupons=10, value=1000) 5.6...
Also, it is possible to make sensibility analysis for bond’s data. In the following case, the present value of the bond is calculated for various values of the yield-to-maturity.
>>> bond(face_value=1000, coupon_rate=5.6, num_coupons=10, ... ytm=[4.0, 5.0, 5.6, 6.0, 7.0]) [1129.77..., 1046.33..., 1000.0..., 970.55..., 901.66...]
And for different values:
>>> bond(face_value=1000, coupon_rate=5.6, num_coupons=10, ... value=[900, 1000, 1100]) [7.0..., 5.6..., 4.3...]
When values for the yield-to-maturity and one value for present value of the bond are supplied, the function prints a report.
>>> bond(face_value=1000, coupon_rate=5.6, num_coupons=10, ... ytm=[4.0, 5.0, 5.6, 6.0, 7.0], value=1000) Bond valuation analysis Reference price: 1000 Analysis: Yield Value Change (%) ($) (%) ------------------------ 4.00 1129.77 12.98 5.00 1046.33 4.63 5.60 1000.00 0.00 6.00 970.56 -2.94 7.00 901.67 -9.83