Giter Club home page Giter Club logo

derivatives's Introduction

derivatives

Based on M. Joshi's C++ Design Patterns and Derivatives Pricing (a practical companion to his Concepts and Practice of Mathematical Finance), making use of updated paradigms wherever possible.

C++17 strongly recommended.

Dependencies & installation

cmake repository for the CMake scripts; included as a submodule.

common repository for utility classes & functions.

The project is built via CMake. One can, of course, modify the CMake configuration at will or use one's own. The documentation is to be built with Doxygen from the provided doxyfile.

Overview

The project roughly follows the second edition of the aforementioned book, which was published in 2008. While the numerics and mathematics haven't changed, C++ has gone through quite a bit of a revolution in the time since. Due to this fact, the original book includes some now archaic elements, such as a self-implemented smart pointer. All such were replaced with their modern equivalents. Some chapters do not correspond to a concrete problem and have been excluded; in others, the sub-problems have often been consolidated/handled in a more generic way.

The code itself is separated into two directories:

  • src: the library itself - this contains all the actual relevant code
  • mains: auxiliary driver/playground code - this merely calls the above for some toy examples

The mains correspond to each relevant chapter. Take a look at the list of includes corresponding to each executable in CMakeLists.txt, to follow along with the development of the library as the book progresses.

Ch. 1 - 5:

These perform Monte-Carlo pricing of various derivatives, with an increasing degree of software architecture.

Ch. 6:

This chapter implements custom random number generators and integrates them with the architecture developed in preceding chapters.

Ch. 7:

Deals with the pricing of exotic, more specifically, path-dependent, options via Monte-Carlo using all the preceding infrastructure.

Ch. 8:

Switches gears and introduces pricing on trees (or lattices). For this, I have developed a helper static recombinant tree class that is found in the common repository (see above). This allows us to price early-exercise options.

Ch. 9:

Deals with the concept of implied volatility and introduces two simple numerical root-finding routines.

Ch. 10, 14:

Introduce the factory pattern & apply it to the existing architecture. The latter improves on the former by making the factory completely generic.

Final

As an exercise, I added pricing on trinomial trees. In the future, I might add low-level parallelization as an additional feature (c.f. the barrier class in common).

NOTE: I have stayed away from C-like input/output parameters and have replaced them with rvalue reference inputs that get moved into, modified in place, and returned by value (moved out). I feel that this syntax is clearer and also mirrors the approach popular Python numerics packages, such as Pandas, are taking with regards to in-place modification. There is also the added benefit of zero additional performance costs, afforded to us by modern C++.

Acknowledgments

Dr. Mark Joshi (RIP)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.