rm(list=ls())
Ausencia de arbitraje implica:
\[ (1+r_{t})^{t} \times (1+f_{t,T})(T-t)=(1+r_{T})^T \]
El precio de cualquier instrumento financiero es igual al valor presente de los flujos de caja esperados .La tasa de interés o la tasa de descuento usado para calcular el valor presente depende del retorno ofrecido de valores comparables en el mercado.
El valor de este bono es el valor presente de los flujos de caja esperados .Para valorar el bono necesitamos información acerca de los flujos de caja como tambien de la tasa de descuento.
Coupon rate
Par value or face value
Years to maturity
Payment period ( usualmente semianuales)
Yield -to maturity (YTM) , en el caso de un bono nuevo en el cual no hay un YTM predefinido , se usa un yield requerido que depende de las características de riesgo asociado al emisor.
Tenemos un bono con las siguientes características:
Coupon rate = 5%
Par value = $1000
Years to maturity = 10 years
Payment period = anual
YTM =8%
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.1.3
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.4 v dplyr 1.0.7
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 2.0.1 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
##install.packages("printr",type="source",repos=c("http://yihui.name/xran"))
##install.packages("pander")
library(pander)
## Warning: package 'pander' was built under R version 4.1.3
library(printr)
## Registered S3 method overwritten by 'printr':
## method from
## knit_print.data.frame rmarkdown
bond<-tibble(t=1:10,
cupon=rep(50,10),
value=c(rep(0,9),1000),
cf=cupon+value,
dcf=cf/(1+0.08)^t)
str(bond)
## tibble [10 x 5] (S3: tbl_df/tbl/data.frame)
## $ t : int [1:10] 1 2 3 4 5 6 7 8 9 10
## $ cupon: num [1:10] 50 50 50 50 50 50 50 50 50 50
## $ value: num [1:10] 0 0 0 0 0 0 0 0 0 1000
## $ cf : num [1:10] 50 50 50 50 50 50 50 50 50 1050
## $ dcf : num [1:10] 46.3 42.9 39.7 36.8 34 ...
bond%>%pander()
| t | cupon | value | cf | dcf |
|---|---|---|---|---|
| 1 | 50 | 0 | 50 | 46.3 |
| 2 | 50 | 0 | 50 | 42.87 |
| 3 | 50 | 0 | 50 | 39.69 |
| 4 | 50 | 0 | 50 | 36.75 |
| 5 | 50 | 0 | 50 | 34.03 |
| 6 | 50 | 0 | 50 | 31.51 |
| 7 | 50 | 0 | 50 | 29.17 |
| 8 | 50 | 0 | 50 | 27.01 |
| 9 | 50 | 0 | 50 | 25.01 |
| 10 | 50 | 1000 | 1050 | 486.4 |
value<-sum(bond["dcf"])
value
## [1] 798.6976
El valor del bono es :
\[ B_0=$50 \left( \frac{1-\frac{1}{1.08^{10}}}{0.08} \right) +\frac{$1000}{1.08^{10}}=$798.69 \]
Muchos de los cupones de los bonos se pagan seminualmente .Sin embargo ,las tasas siempre se cotizan anualmente.Esto quiere decir que el periodo del bono es de 6 meses ,y el coupon rate por periodo es \(\frac{8\%}{2}=4\%\) .Si el YTM es 4% , el valor del bono sería: \[ B_0=$25 \left( \frac{1-\frac{1}{1.04^{10}}}{0.04} \right) +\frac{$1000}{1.04^{10}}=$796.14 \]
bond1<-tibble(t=1:20,
cupon=rep(25,20),
value=c(rep(0,19),1000),
cf=cupon+value,
dcf=cf/(1+0.04)^t)
bond1%>%pander()
| t | cupon | value | cf | dcf |
|---|---|---|---|---|
| 1 | 25 | 0 | 25 | 24.04 |
| 2 | 25 | 0 | 25 | 23.11 |
| 3 | 25 | 0 | 25 | 22.22 |
| 4 | 25 | 0 | 25 | 21.37 |
| 5 | 25 | 0 | 25 | 20.55 |
| 6 | 25 | 0 | 25 | 19.76 |
| 7 | 25 | 0 | 25 | 19 |
| 8 | 25 | 0 | 25 | 18.27 |
| 9 | 25 | 0 | 25 | 17.56 |
| 10 | 25 | 0 | 25 | 16.89 |
| 11 | 25 | 0 | 25 | 16.24 |
| 12 | 25 | 0 | 25 | 15.61 |
| 13 | 25 | 0 | 25 | 15.01 |
| 14 | 25 | 0 | 25 | 14.44 |
| 15 | 25 | 0 | 25 | 13.88 |
| 16 | 25 | 0 | 25 | 13.35 |
| 17 | 25 | 0 | 25 | 12.83 |
| 18 | 25 | 0 | 25 | 12.34 |
| 19 | 25 | 0 | 25 | 11.87 |
| 20 | 25 | 1000 | 1025 | 467.8 |
value1<-sum(bond1["dcf"])
value1
## [1] 796.1451
bondprice<-function(rcupon,par,years,pp,yield){
n<-years * pp
df<-tibble(t=1:n,
cupon=rcupon*par/pp,
value=c(rep(0,n-1),par),
cf=cupon+value,
dcf=cf/(1+yield/pp)^t)
price<-sum(df['dcf'])
return(list(price,df))
}
Ejemplo 1 :
Tenemos un bono con las siguientes características:
Coupon rate = 5%
Par value = $100
Years to maturity = 10 years
Payment period = semiannual
YTM =8%
rcupon<-0.05
par<-100
years<-10
pp<-2
yield<-0.04
m<-bondprice(rcupon,par,years,pp,yield)
m[1]
## [[1]]
## [1] 108.1757
Ejemplo 2 :
Tenemos un bono con las siguientes características:
Coupon rate = 8%
Par value = $100
Years to maturity = 5 years
Payment period = semiannual
YTM =5%
bondprice(0.08,100,5,2,0.05)[1]
## [[1]]
## [1] 113.1281
m2=bondprice(0.08,100,5,2,0.05)
m2[2]%>%pander()
| t | cupon | value | cf | dcf |
|---|---|---|---|---|
| 1 | 4 | 0 | 4 | 3.902 |
| 2 | 4 | 0 | 4 | 3.807 |
| 3 | 4 | 0 | 4 | 3.714 |
| 4 | 4 | 0 | 4 | 3.624 |
| 5 | 4 | 0 | 4 | 3.535 |
| 6 | 4 | 0 | 4 | 3.449 |
| 7 | 4 | 0 | 4 | 3.365 |
| 8 | 4 | 0 | 4 | 3.283 |
| 9 | 4 | 0 | 4 | 3.203 |
| 10 | 4 | 100 | 104 | 81.24 |
for(y in 1:10){
yield<-y/100
price<-bondprice(0.05,100,10,2,yield)[1]
print(price)
}
## [[1]]
## [1] 137.9748
##
## [[1]]
## [1] 127.0683
##
## [[1]]
## [1] 117.1686
##
## [[1]]
## [1] 108.1757
##
## [[1]]
## [1] 100
##
## [[1]]
## [1] 92.56126
##
## [[1]]
## [1] 85.7876
##
## [[1]]
## [1] 79.61451
##
## [[1]]
## [1] 73.98413
##
## [[1]]
## [1] 68.84447