Design Patterns and Derivatives Pricing 2nd Edition

This is the homepage for my book which was published June 8th 2004 by Cambridge University Press. Here is the cover blurb:

Newly updated second edition and now in paperback! This is the first book on implementing financial models using object-oriented C++. Assuming only a basic knowledge of C++ and mathematical finance, the reader learns how to produce well-designed, structured, reusable code via carefully-chosen examples. This new edition includes several new chapters covering topics of increasing robustness in the presence of exceptions, designing a generic factory, interfacing C++ with EXCEL, and improving code design using the idea of decoupling. Complete ANSI/ISO compatible C++ source code is hosted on an accompanying website for the reader to study in detail, and reuse as they see fit. Whether you are a student of financial mathematics, a working quantitative analyst or financial mathematician, you need this book. Offering practical steps for implementing pricing models for complex financial products, it will transform your understanding of how to use C++.


Here is a class diagram of all the classes in the book. This was created by Hamid Arian.

I have now created a bulletin board to make it easy for readers to ask questions and discuss details in the book.

The original CD was highly defective -- the publishers appear to have messed up the files in several ways rendering the code unusable. My apologies if this is causing you trouble. Here is a copy of the code that should work. This problem was fixed on all new copies from September 2004.

The code was originally tested under Mingw 2.95, Visual C++ 6.0 and  Borland 5.5. It should therefore work under most compilers. If you are having trouble with another compiler please let me know and I will do my best to help. Even better if you had trouble with another compiler and managed to fix the problem, please let me know. I have also tested under MingW 3.2 and Visual C++ 8.0.

I have also heard from others that it works on Visual Studio .Net 2002, 2003 and 9.0.

Buy from
Buy from


"This book is thought-provoking and rewarding. Even for the less experienced programmer, the presentation is readily accessible, and the coded examples can be directly used to solve real-life problems." Journal of the American Statistics Association, Ana-Maria Matache

'This is a short book, but an elegant one. It would serve as an excellent course text for a course on the practical aspects of mathematical finance.' International Statistical Institute

"It is good for anyone who knows C++ language but does not have object-oriented programming experience. He also integrates finance into the codes very well. After reading his book, future quants will know why C++ programming is so important such days and how one can do in real life. "

Strongly recommended by

"Joshi does not intend to teach financial mathematics in this text. To learn about this topic, you can read his other book "The Concepts and Practice of Mathematical Finance". Joshi also doesn't try to provide an introduction to C++ programming -- there are plenty of good books on this topic.

Instead, the author does an excellent job of demonstrating how common C++ design patterns (templates, wrappers, decorators, bridges, factories, and so on) can be applied to price financial derivative instruments.

The book develops reusable components that are subsequently combined in a simple Monte Carlo framework, capable of pricing certain path-dependent European options. Another section uses Binomial Trees to tackle the early exercise challenges presented by American options.

The aim of the book is to allow the reader to develop an intuition for using the design tools rather than to provide an exhaustive framework. As a consequence, more complex instruments -- including any credit or interest rate dependent products -- are not covered. Finite difference methods are also not presented. But the design tools described are equally applicable to these areas.

Bottom line: "C++ Design Patterns and Derivatives Pricing" is a good addition to your quant library. "

Rico Blaser

It is, however, a very good book for someone already working in the finance industry who doesnít have a lot of free time and doesnít want to learn things that are probably not relevant. C++ has many features, and there are many ways of combining them to develop good codes. Although Joshiís treatment of design tools is not exhaustive, enough is provided so that the reader develops a sense of how to use them. The book does not focus on syntactical rules, but rather on when to use the language features that can be useful in financial applications. Many books on C++ are very large and cover much material that is not important to a quant. This book, although it is quite short, does cover a significant amount of material and does deal with some fairly advanced topics that are important to practitioners. The real strength of the book is its clarity and conciseness. It is because Joshi writes so well that the reader may wish he had covered more. Joshi has written another book, The Concepts and Practice of Mathematical Finance, where he covers the finance topics that arenít covered in this book. At least one of us plans to buy that book

Anita Mayo, SIAM Review

Back to