Monday, 9 July 2018

Bond introduction

Bonds

Bonds are financial instruments that can be considered as a 'reverse' loan. That is, if you buy a bond you are lending money to the party that issued the bond. As per any loan, you should expect to be paid for the risk of lending money. This is no different to bonds, and so issuers specify what percentage (known as coupon) of the total amount loaned they will pay back per year. This coupon rate shall be paid by the issuer to the holder of the bond with a set, transparent schedule. At the end of the loan (known as maturity) the issuer of the bond shall return the money loaned back, freeing any further obligations to make payments to the owner of the bond.

The total amount of money 'loaned' per bond is relatively large. Therefore bonds are split up into units, as the loan size is often too large for any one investor to handle. These units are known as principle or par-value. So any given bond will consist of many smaller units of principle or par value. For example, there may be 10,000,000 units available at a par value of €1,000 indicating a total of €10,000,000,000 outstanding. This is not an unusual amount in the bond market!

If the issuer doesn't pay the coupon, or fails to return the principle at maturity the issuer is declared 'in default'. As a bond holder, you don't want this to happen - there is a chance the issuer will never pay you back!

Thus, over time, the price of the bond fluctuates, reflecting the market perveived risk of the bond. Bonds are priced as a percentage of the initial trading price. The initial trading price is almost always 100 % of itself (100 basis points, known as bp). If a bond is trading below 100 bp, say 95 bp, then you'll pay 95 cents to the dollar for par-value unit of the bond. Likewise if the bond is trading at 110.50 bp, you'll pay 110.5 % for each par-value unit of the bond.

Technically, pricing of bonds is in the unit of percentages (therefore the term basis point). We typically divide the actual cost in monetary value of the bond price by it's par value to get the basis-point value.

You can read more about bonds of course on wikipedia

Pricing

We can define the price of bond as a function of time, i.e \(X(t)\). For bonds that have a fixed maturity date, \(t \in {0,T}\), an interesting pattern emerges. Here's a plot of the price of a French 30 year bond that expires in 2019. Interesting to note that even though the currency of the initial bond would not have been in Euro, this product is still tradeable today.

Do you notice anything interesting? The price fluctuates over the first few years, and reaches a peak at around 2005. From around 2013 the price steadily retreats back to 100 as time approaches maturity (\(t\) approaches \(T\)). This is no coincidence. Except for default events, in the later stages of the bond's life, the likelihood of receiving your money back increases as time approach maturity. Of course, as the bond is young, there still is significant long term risk, which is why we see the price peak somewhere in the middle of the bonds life.

Cashflows

At the core of bond revenue is cashflows. Let's jump to an example.

We consider a ficticious bond, paying 5% coupon - paid monthly, with principle of $1000 for a period of 2 years. Liquidity is not taken into consideration for yield to maturity.

We can plot the cashflows below:

cashflows = function(coupon,principle,maturity){
  # coupon is a percentage between 0 and 1
  # principle is determined by the issuer and is in $/
  # maturity is time in years remaining
  # assume monthly repayments
  
  # generate time vector
  times = seq(1,12*maturity)
  
  # generate repayments vector
  cashflows = rep(coupon/12 * principle, maturity * 12)
  
  # the issuer also pays back the principle (known as bullet) at maturity
  cashflows[maturity*12] = cashflows[maturity*12] + principle
  
  return(list('time' = times, 'flows' = cashflows))
}

revs = cashflows(coupon = 0.05, principle = 1000, maturity = 2)
print(revs)
## $time
##  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## [24] 24
## 
## $flows
##  [1]    4.166667    4.166667    4.166667    4.166667    4.166667
##  [6]    4.166667    4.166667    4.166667    4.166667    4.166667
## [11]    4.166667    4.166667    4.166667    4.166667    4.166667
## [16]    4.166667    4.166667    4.166667    4.166667    4.166667
## [21]    4.166667    4.166667    4.166667 1004.166667

Yield

What makes a bond a good investment? You could consider calculating the net revenue you could expect to make from buying the bond. You can calculate a basic yield by dividing net income by invested capital. You can then look for bonds that offer high yields for low risk.

But how do we calculate net income? And what do we need to take into consideration? This rapidly gets complicated, so I'll stick to the basics. A few of the main points to consider are:

  1. Coupon. How much will we receive from coupon repayments
  2. Principle. Buying at a discount (< 100bp) will return more money at maturity than what was initially invested. The converse is also true.
  3. Time. If we invest $1000 for 10 years, how much could we have made using a risk-free investment?
  4. Liquidity. Can we buy or sell the bond at any point in time?
  5. Options. Does the issuer have a right to buy or sell the bond at any point in time?
  6. Convertability. Do we, as a buyer, gain any rights to conver the bond into stock or cash?
  7. Equity. Some bonds offer the same risk profile but require more equity to achieve this - return on equity is important for your own cashflow.

As you can see, there are many things to consider - and this list isn't even exhaustive.

Yield to maturity

Yield to maturity equates the current price to the future cashflows discounted by a single interest rate. The resulting interest rate is known as the yield to maturity.

For this to make sense, we assume that the buyer holds the bond until maturity, there are no conversion instances and no default event occurs.

For each cashflow at time \(t\) (with \(T\) being maturity), we are going to discount it by our theoretical yield-to-maturity rate \(i\). Mathematically this is defined as: \[ Price = \sum_{t=1}^{T} \frac{Cashflow_t}{(1+i)^t}\]

In R this we can calculate the yield to maturity, \(i\), for a given price using a linesearch method to minimise the squeare of the difference between the LHS and RHS above. You can also do this analytically, an exercise left to the reader!

discounted_cashflows = function(coupon, principle, maturity, i){
  # number of payents
  num_payments = maturity*12
  
  # Future cashflows
  flows = cashflows(coupon = coupon, principle = principle, maturity = maturity)$flows
  
  # Discount factor
  discount_factor = (1 + i)^(1+(1:num_payments)/num_payments)
  
  return(sum(flows / discount_factor))
}

discounted_cashflows(coupon = 0.05, principle = 1000, maturity = 2, i = 0.045)
## [1] 1009.262
# Optimise function for yield to maturity
yield_to_maturity = function(coupon,principle,maturity,price){
  price_bond = price * principle
  
  result = optimise(function(x){
      (price_bond - discounted_cashflows(coupon, principle, maturity,i = x))^2
    }, interval = c(0,1), tol = 0.001)
  
  return(result$minimum)
}

# Assume price is 95 bp, what is the yield to maturity?
yield_to_maturity(coupon = 0.05, principle = 1000, maturity = 2, price = 0.95)
## [1] 0.07781898
# At 105 bp what is the yield to maturity?
yield_to_maturity(coupon = 0.05, principle = 1000, maturity = 2, price = 1.05)
## [1] 0.02423136

In fact, we can plot the price vs. yield to maturity now for this fictitious bond

prices = seq(0.5,1.25,by = 0.0125)
ytm = sapply(prices, function(x) yield_to_maturity(0.05,1000,2,x))
plot(prices,ytm, type = 'l',main = "Price vs. Yield", xlab = 'Price in % bp', ylab = 'Yield to Maturity in %')

Interestingly we can see the yield decrease as price increases, and that once the price reaches about 115 bp the yield effectively zero.

Conclusion

This is a very short introduction into the very basics of bonds. We covered what a bond is, how it's priced, cashflows and yield to maturity. Hopefully I'll have more complex posts in the future on bonds!