Plugs - 010 - Pure, Functional, Financial Python Katas

The last kata showed us how financiers sees the future - by closely observing the present.

Let's take this one step further.

As we saw, in pseudo code, our forward is defined as,

F = S(t) * exp(r * (T-t))

where S(t) is an asset price at time t, otherwise called the spot price.

T is the maturity or delivery date of the forward.

r is the interest rate.

It may not surprise you, but sometimes the academic jedi-mind-trick, aka the "Arbitrage Principle" presented in the last kata doesn't work!

Sometimes,

F < S(t) * exp(r * (T-t))

which is called backwardation, when the forward is worth less than the compounded price of the asset.

Or even

F > S(t) * exp(r * (T-t))

when the forward is worth more, this is called contango.

Let's see when this happens.

FX Forwards

FX forwards have two interest rates! One for the each currency we are exchanging. That means we need to use the foreign interest rate,

F = S(t) * exp((r - rf) * (T - t))

Commodity Forwards

Commodities cost money to store, which is why when you hold a paper contract which allows you buy corn or gold in the future, someone currently holding the commodity has to pay for storage.

When you buy a forward, part what you are buying is the cost of storage, so the cost of the forward increases. Think how expensive it is to secure gold bars!

On the other hand, if you are a trucking business, having a pool of petrol to hand might be super useful if you experience a sudden spike in business.

We use both costs and benefits to equalise our equation.

F = S(t) * exp((r + s - c) * (T-t))

The exercise today is to write out lambda expressions which find the 'plug' variables.

In this case c is our plug for convenience yield, assuming that s or the cost of storage is known.

Equity Forwards

The plug in this case is the dividend yield of the stock. As the stock pays the current holder overtime, it lowers to cost of the forward.

F = S(t) * exp((r - q) * (T-t))

In this way see the current expectations of future dividends.

Again, write the Python lambda expression to solve for q.

Upshot

You will see the 'plug' pattern over and over again. Not too harmful here, but anything financiers cannot really figure out they will 'calibrate' a plug value to make things add up.

It's a way to plaster over ignorance, but can be useful as long as you realise what it is - sticky tape.

~

What is even more interesting, is that when we have plug variables we cannot value things anymore. If you worked on the two exercises for today, you will have realised that the F will have moved from the left hand side of the lambda expression to the right hand side!!

This move is perhaps the most interesting part of quantitative finance, because if it doesn't help us pinpoint the price of things, what does quant finance actually help us with?