O'Reilly logo

Financial Instrument Pricing Using C++, 2nd Edition by Daniel J. Duffy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 21Software Framework for One-Factor Option Models

21.1 Introduction and Objectives

In this chapter we concentrate on implementing the algorithms that describe the finite difference schemes from Chapter 20. We use a combination of styles that C++ has to offer to show what is possible. Chapter 20 deals with the mathematics of the problem and associated numerical methods, whereas this chapter focuses on how to map the algorithms to C++. There is thus a clear separation of concerns. More precisely, the goals in this chapter are:

  • Το create a seamless mapping from FD algorithms to C++, thus helping us to create code that is built to be maintained and extended. We achieve this end by using system decomposition methods and design patterns.
  • Το experiment with a range of FD schemes (some of which are new in finance) and determine how stable and accurate they are.
  • Having determined that a scheme is to our liking, to optimise the code by modifying the design or the code in some way in order to improve the performance.

We discuss a number of design and coding styles to satisfy the first two goals. We then measure the run-time performance of the code to determine whether it satisfies the third goal.

The skills developed in this chapter can be applied to a range of applications. We make this claim based on how we designed problems in Chapter 9. The key issues are to decide what the initial high-level architecture is going to be and how we design classes, class hierarchies and polymorphic ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required