Metaphysical - 011 - Pure, Functional, Financial Python Katas

The last kata threw open the meaning of quantitative finance. Ironically, if quant finance is about quantifying, it is rarely if ever about quantifying dollars!

It's about quantifying the metaphysical.

Perhaps that's fitting, because the future is always metaphysical to some degree (unless you're a physicist).

The past is completely deterministic however.

There is no ambiguity in contracts that have matured or expired. The terms of the contracts are crystal clear.

If K is the delivery price and S the spot price, our forward is set to be the difference of these two values at the maturity or delivery date T.

F(T) = S(T) - K

A child can calculate this, the difficulties arise when T is in the future and we occupy t.

And this is the same with the second of the two types of securities in finance.

(Yes there are really only two fundamental security types in finance)

Options give the holder the right to buy or sell an asset at some time in the future, for an agreed upon price.

Forwards are not optional, you must buy or sell the asset at maturity.

Therefore the equation for call options (the right to buy an asset) in pseudo code is,

C(T) = max( S(T) - K, 0 )

Put options, or the right to sell, look like so,

P(T) = max( K - S(T), 0 )

Following from kata 005, use matplotlib only with lambdas to plot:

1) long and short forwards at time T with respect to changing spot prices

2) plot the forwards with respect to both changing spot prices and plug variables (e.g. dividend yield, as covered in the previous kata) at time t

3) do the same for both call and put options at expiry time T