Displaying 2 results from an estimated 2 matches for "freq_coupon".
2010 Jan 19
0
Macualay Duration code in a Functional Form - Please Help
# I have written this code in Notepad++ and copied here.
## ONS - PPA
Duration = function(par_value, coupon_rate, freq_coupon, tenure, ytm)
{
macaulay_duration = NULL
modified_duration = NULL
freq_coupon_new = NULL
if(freq_coupon <= 0)
{
freq_coupon_new = 365
}
if(freq_coupon > 0 & freq_coupon <= 1)
{
freq_coupon_new = 12
}
if(freq_coupon > 1 & freq_coupon <= 2)
{
fre...
2010 Jan 19
0
Macaulay Duration for Group
...frequency_coupon = 1 means, total number of times compounding is done = 12.
My R Code for calcualting Macaulay Duration is as follows -
## INPUT
ONS = read.csv('instrument details..csv')
par_value = ONS$par_value
coupon = ONS$coupon_rate*par_value/100
freq_coupon = ONS$frequency_copoun
tenure = ONS$tenure
ytm = ONS$ytm
# _________________________________________________________________________________________________
## COMPUTATIONS
macaulay_duration = NULL
modified_duration = NULL
freq_coupon_new = NULL
if(freq_co...