Financial Poetry

I once dated a poet. A published poet.

She knew the nuances of language like few others.

Then and since I wondered whether I could experience things, that I could never verbalise, as well as her.

If you can dictate your inner life onto a page; into black and white; does it become a little clearer? Do you experience more?

Logical Alliteration

Mathematics provides clarity to ideas which are sometimes hard with natural language.

Ada Lovelace was brought up to believe that language was the gateway to sin. Her father Lord Byron was a romantic poet and terribly immoral in her mother's eyes - so Ada was fed a strict diet of maths and logic as she grew up. In the hope she would not follow in her father's footsteps.

Ironically, later she would say she became a 'poetical scientist', in modern terms, in fact she became the world's first programmer.

A poet of logic.

Monetary Rhymes

In finance we use maths to precisely communicate ideas and computers to apply the ideas to our world.

How about communicating with computers in a specifically designed financial language?

It turns out that you need only about 10 pieces of vocabulary to describe the vast majority of financial contracts.

For example, a zero coupon bond is described thus,

when (at t) ( scale (konst x) (one k) )

(If you are thinking this function looks terribly like Haskell, you are not wrong!)

The when function takes two arguments.

A boolean (true or false) argument. In this case at t checks whether the current time is equal to t.

The second argument describes what happens when the first argument is true.

scale is a multiplicative function. It also takes two arguments, a quantity and a unit.

The upshot is that a 100 SGD zero coupon bond maturing this day twenty years hence is described as,

when (at 'May 7th 2025') ( scale (konst 100) (one 'SGD') )

you can wrap this in a convenient function

zcb t x k

if you wish.

There is a real advantage to having a collection of reusable lego bricks underlying the function however - we don't need to start from scratch every time we want to model something new.

Another example, a European option contract is described as,

when (at t) (u 'or' zero)

where 'or' is a Haskell infix function which gives us a choice between acquiring u (a security or contract) and zero (i.e. do nothing).

A European option to buy the previous zero coupon bond this time next year would look like:

when (at 'May 7th 2016') ( ( zcb 'May 7th 2025' 100 'SGD' ) 'or' zero )

again we can wrap it into a nice function

european u t

The paper is light on valuation details.

Over the next weeks I will sketch a DSL in Javascript.

Unfortunately Javascript is not as eloquent as Haskell. Elm and Purescript are nice but not very amenable to newbies (compilation and GHC dependencies).

Valuation might be difficult, but the paper has reminded me a little of my lazy binomial tree and Monte Carlo posts.

Perhaps the endeavour will end up tricky but tractable.

A financial language has many potential benefits.

One intriguing possibility is the symbolic reasoning of financial contracts.

Financial engineers love the idea of replicating derivatives and portfolios into simpler more liquid components.

Domain specific languages have the potential to bring out the poets in all of us and clarify our ideas.