Binomial Option Pricing Application

Try e.g. small vol and large drift etc.

Hmmm. The drift is not in the BS equation, so how would I test that? By Girsanov's Theorem the drift is not present. I'm pretty sure this: Girsanov theorem - Wikipedia, the free encyclopedia theorem lets you get rid of the drift term in BS.

If your lattice is generic you can do all these with no change of code
Hold on, my lattice is generic. It let's the user choose the type of data the lattice can hold. Isn't that the definition of a generic class? So does that mean I can program the algorithms you mentioned? Should I make the program work for an arbitrary lattice, trinomial, monomial etc?

Very good but only (less than) half the battle. 90% is maintaining software as it is extended, debugged, falls apart down all the years etc.

Good point. Especially with these crazy fast computers (the age of quantum computing: see The jaw-dropping promise -- and brain-twisting challenge -- of quantum computing). Probably means design will far outweigh efficiency aspects in the future.

Daniel Duffy

C++ author, trainer
Sorry, I meant the BinomialTree is not generic, while the BinomialLattice is (more or less).

One way to keep things maintainable is promote loose coupling using Layers pattern:

1. The lattice ADTs
2. Functions that operate on 1 (e.g. back/fwd induction)
3. Configuration of stuff in layers 1 and 2.

Daniel Duffy

C++ author, trainer
Some remarks on the code:

1. BinomialLattice will not support e.g. boost data as Time
(need (unordered)map<TimeAxis, std::vector<Node>>

2. A code review of Solve() might be good w.r.t. readability and efficiency.

Daniel Duffy

C++ author, trainer
"Should I make the program work for an arbitrary lattice, trinomial, monomial etc?"

That's up to you

1. Yes
2. No

Scope the problem at the outset. Maybe the s/w equivalent of the iphone evolutionary products.

Daniel Duffy

C++ author, trainer
The generic parameters of a lattice are:

1. The underlying data type (double, tuple, matrix)
2. The time axis
3. The number of probability jumps (for branching) e.g. 2, 3, 5
4. ?
Last edited:
"I've got a nice Binomial Option (call) pricing application (I could easily extend it for put options later)."

Some remarks/idea on the problem:

1. How do you extend to put options? e.g. using an OO or functional approach?
2. The class is hard-coded for GBM and equities.
3. The alias template is useful (better than typedef).
4. What about a lattice structure ADT that subsumes both binomial and trinomial? If you are ambitious try variadic tuples :)
5. I would like to use the code ADT as data to do polynomial (e.g. Neville) interpolation.
6. Using lambda functions to configure the application (e.g. payoffs).
7. How to support early exercise,dividends and barriers.

Hi Daniel,

With regards to your binomial example,

I have the code for american call and put option with discrete dividend written in c++, I also have the code for american call option greeks (with no discrete dividend) I would like to be able to add this code to the discrete dividend code so I have the greeks for them. This is what I am currently struggling with, do you have any suggestions or test code which contains everything together, the american call option with discrete dividends and then the greeks also? (binomial)

Best Regards,

Daniel Duffy

C++ author, trainer
What kind of dividend policy? Cash dividends lead to non-recombining lattices and you have to worry about arbitrage.

See the "back to basics" article by Haug, Haug and Lewis

and a PDE discussion here

Wilmott Forums - negative transition probability

You may need to create multiple lattices for certain kinds of greeks to 'bump' the parameters.