Original URL: http://www.theregister.co.uk/2006/07/28/financial_instrument_pricing/

## Financial instrument pricing using C++

Getting into the lucrative parts of coding

Posted in Developer, 28th July 2006 11:02 GMT

**Book review** C++ is the most used language in that most lucrative of fields: financial engineering. Yet most of the people who use it for derivatives have no formal training in programming, and often use C++ as little more than C, or even as a mutant form of Fortran. The results are not always pretty.

Duffy tries to show how modern OO and pattern directed development could produce more robust code - that still runs fast. To that end, he doesn’t cop out by solving all “hard” problems by Monte Carlo simulation and, given that this sort of work is mostly structured number crunching, he adds to his coverage: STL, XML, Excel interfacing and patterns; as well as a good treatment of the underlying maths. That’s broader than most programming books even attempt and this means that the coverage of things like STL and UML are shallower than they’d be in a dedicated book. Nevertheless, if all you’re going to be doing is pricing basket options, then this focus probably suits you.

This book is aimed at those with at least undergraduate maths, so it first refreshes basic stats, calculus and linear algebra before getting to the real meat: numerical solutions to partial and stochastic differential equations (see here for some notes on the techniques mentioned below). Starting with the standard Euler scheme for discretisation, Duffy shows how this is hopelessly bad in the Black Scholes (BS) framework; and moves quickly into more appropriate fitting schemes, through Richardson and the more widely used predictor-corrector. As this is basically a cookbook, there’s not a lot of formal proof, although the code does allow you to compare the quality of the output of the methods described.

The more efficient methods tend to require the repeated solution of systems of equations, and Duffy skips lightly over the Cryer scheme brought to finance by Wilmott. A little more hand holding in this area would have added greatly to the value of the book. But the application of this set of techniques to BS is rather good, bringing in Crank Nicolson with its limitations; and showing how ADI et al can mitigate most of the issues, albeit at the cost of more complexity. The section on exotics is again too brief, but gives good tips on getting started.

There’s also an XML section, for no good reason that I can think of *[fashion? Ed]*; although it competently manages to link the relevant ideas into financial data even though hardly any quants get their data in that form as yet. The more common way of getting data is through Excel, and Duffy covers COM in enough depth that you can cook up your own interface relatively quickly.

In this it goes rather further and deeper than Bourg’s Excel book (see my review here), and thus it’s not really ideal for a beginner; but it’s refreshing to see someone go beyond yet another “…for dummies” level book.

### Financial Instrument Pricing Using C++

Verdict: Duffy’s book is far from ideal as your first book on programming in mathematical finance (Wilmott, Joshi and Stroustrup cover that) but in today’s market, it is easily the best book to read after them.

**Author:** Daniel Duffy

**Publisher:** John Wiley & Son

**ISBN:** 0470855096

**Media:** Book

Buy this book at Cash & Carrion!