Displaying 1 result from an estimated 1 matches for "face_value".
Did you mean:
each_value
2010 Feb 02
2
Yield to Maturity using R
...n will change if tenure or no_comp etc. changes. So taking into account the variable nature of the input, I am trying to write a generalized code.
## Input
price = 101 # Price of bond
tenure = 3
no_comp = 1 # no of times coupon paid in a year.
coupon_rate = 0.10 # i.e. 10%
face_value = 100
# Computations
coupon_payment = face_value * coupon_rate
cash_flow = c(rep(c(coupon_payemnt), (no_comp * tenure - 1)), face_value + coupon_payment)
cash_flow
## I am trying to customize the code as given by Mr Ellison.
f.ytm = function(ytm)
{
for (i in 1 : (tenure * no_comp - 1)...