It's been a little while since I've coded any F#, so I've done a little coding kata to polish off the rust.
I've converted the explicit finite difference option pricing example from (Paul Wilmott Introduces Quantitative Finance).
I followed similar steps as those I performed in my previous blog post on the binomial tree option pricing; I converted the VBA code into very similar looking imperative F# code, before refactoring out the loops into recursive calls.
It was a useful exercise as converting the algorithm made me actually focus on the mechanics of how it worked, much more than simply translating VBA code into imperative F#. It’d be interesting to hear in the comments whether people find it easy to read.
The code is available https://gist.github.com/taumuon/4999749.
Labels: F#, QuantFinance