Lazy Binomial Tree

Zoran Mušič was once given a choice.

An either-or choice.

So absurd that he burst out with laughter when he heard it.

Absurd Reductionism

Quantitative finance often reduces prices to either-or movements in such an absurd fashion.

The binomial tree price movement model breaks the time between now and some point in the future into chunks. At the beginning of each chunk a stock price can move up or down. Only up or down.

At the end of the first chunk of time there are two possible movements; second four; third eight; fourth sixteen and so on.

This is easy to code, but I thought I would follow up my previous post on lazy Monte Carlo with one showing how elegant lazy evaluation can be with more complex data structures.

The 'easiest' complex structure in finance is the binomial tree.

Tree Nursery

As mentioned, stocks can only move up or down. This is represented by one line of code (broken apart for readability):

var binomialTree = ... nodes.reduce( function(acc,node){ return acc.concat( [ //{asset level up, probability up} {s:node.s*u, p: node.p*p}, //{asset level down, probability down} {s:node.s*d, p: node.p*(1-p)} ] ); } ,[] ); ...

(download)

which splits every existing node two, so if we start with

[{s:100,p:1}];

where s is the stock price now and p is the probability of being at that price now, we will get 2, 4, 8, 16 ... possible prices as our code grows the tree. Each price s is shock by a factor u when the price increases and by d when it decreases.

One line of code defines the whole tree. Neat, huh?

If we define a European call option contract as

var call = function(s,k){ return Math.max(s-k,0); }

where k is the call option's strike price.

we can price the call with something along the lines of

binomialTree.npv(call);

where binomialTree is our lazy binomial tree data structure.

The npv method takes all the possible call option prices at expiry; finds the expected value of the option; and discounts it.

Metamorphosis

The Crank Nicolson method would be interesting to investigate. There might be more of a contrast between the ugly imperative code and an elegant lazy solution.

Nevertheless the binomial tree is a good pedagogical method; it is also a clear example of the absurd reductionism found in finance.

Momentarily Binary

Sometimes life throws up equally absurd moments.

Zoran Mušič was in German occupied Venice when he was interrogated and tortured by the Gestapo.

He didn't talk.

Finally his captors gave him a choice.

He burst out laughing. He could only do one thing.

He could never become an SS soldier, so was sent to concentration camp.