O'Reilly logo

C# for Financial Markets by Andrea Germani, 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

9

Binomial Method, Design Patterns and Excel Output

9.1 INTRODUCTION AND OBJECTIVES

In this chapter we design and implement a well-known application, namely the binomial method to price one-factor and two-factor options. The reasons for discussing this well-known case are:

  • We design and implement the method in C#, using its object-oriented features, support for generics and the use of .NET libraries. The reader can compare the proposed solution with solutions using VBA, C++ and pseudocode.
  • In contrast to a procedural or object-oriented design of the application we view it as being a special case or instance of a domain architecture (see Duffy 2004b). Realising this fact, we can then decompose the system into a set of loosely coupled subsystems, each of which has a well-defined interface. Having done so, we can then implement each subsystem using a combination of C# interfaces and classes.
  • We apply Design Patterns (GOF 1995) to promote the maintainability and flexibility of the application. For example, we use the Factory Method pattern to initialise the input to the binomial method and we use the Strategy pattern to compute certain parameters in the model.
  • The system design knowledge that we acquire in this chapter can be applied to other pricing applications. For example, we shall see in Chapter 10 that the system design for a PDE/FDM solver is similar to the one that we discuss in this chapter. In fact, both applications (binomial, PDE/FDM) are special cases of a domain architecture ...

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