Book description
An integrated guide to C++ and computational financeThis complete guide to C++ and computational finance is a follow-up and major extension to Daniel J. Duffy's 2004 edition of Financial Instrument Pricing Using C++. Both C++ and computational finance have evolved and changed dramatically in the last ten years and this book documents these improvements. Duffy focuses on these developments and the advantages for the quant developer by:
- Delving into a detailed account of the new C++11 standard and its applicability to computational finance.
- Using de-facto standard libraries, such as Boost and Eigen to improve developer productivity.
- Developing multiparadigm software using the object-oriented, generic, and functional programming styles.
- Designing flexible numerical algorithms: modern numerical methods and multiparadigm design patterns.
- Providing a detailed explanation of the Finite Difference Methods through six chapters, including new developments such as ADE, Method of Lines (MOL), and Uncertain Volatility Models.
- Developing applications, from financial model to algorithmic design and code, through a coherent approach.
- Generating interoperability with Excel add-ins, C#, and C++/CLI.
- Using random number generation in C++11 and Monte Carlo simulation.
Duffy adopted a spiral model approach while writing each chapter of Financial Instrument Pricing Using C++ 2e: analyse a little, design a little, and code a little. Each cycle ends with a working prototype in C++ and shows how a given algorithm or numerical method works. Additionally, each chapter contains non-trivial exercises and projects that discuss improvements and extensions to the material.
This book is for designers and application developers in computational finance, and assumes the reader has some fundamental experience of C++ and derivatives pricing.
HOW TO RECEIVE THE SOURCE CODE
Once you have purchased a copy of the book please send an email to the author dduffyATdatasim.nl requesting your personal and non-transferable copy of the source code. Proof of purchase is needed. The subject of the mail should be “C++ Book Source Code Request”. You will receive a reply with a zip file attachment.
Table of contents
- Cover
- Title page
- Copyright page
-
Chapter 1 A Tour of C++ and Environs
- 1.1 Introduction and Objectives
- 1.2 What is C++?
- 1.3 C++ As a Multiparadigm Programming Language
- 1.4 The Structure and Contents of this Book: Overview
- 1.5 A Tour of C++11: Black–Scholes and Environs
- 1.6 Parallel Programming in C++ and Parallel C++ Libraries
- 1.7 Writing C++ Applications; Where and How to Start?
- 1.8 For Whom is this Book Intended?
- 1.9 Next-Generation Design and Design Patterns in C++
- 1.10 Some Useful Guidelines and Developer Folklore
- 1.11 About the Author
- 1.12 The Source Code and Getting the Source Code
- Chapter 2 New and Improved C++ Fundamentals
-
Chapter 3 Modelling Functions in C++
- 3.1 Introduction and Objectives
- 3.2 Analysing and Classifying Functions
- 3.3 New Functionality in C++: std::function<>
- 3.4 New Functionality in C++: Lambda Functions and Lambda Expressions
- 3.5 Callable Objects
- 3.6 Function Adapters and Binders
- 3.7 Application Areas
- 3.8 An Example: Strategy Pattern New Style
- 3.9 Migrating from Traditional Object-Oriented Solutions: Numerical Quadrature
- 3.10 Summary and Conclusions
- 3.11 Exercises and Projects
-
Chapter 4 Advanced C++ Template Programming
- 4.1 Introduction and Objectives
- 4.2 Preliminaries
- 4.3 decltype Specifier
- 4.4 Life Before and After decltype
- 4.5 std::result_of and SFINAE
- 4.6 std::enable_if
- 4.7 Boost enable_if
- 4.8 std::decay()Trait
- 4.9 A Small Application: Quantities and Units
- 4.10 Conclusions and Summary
- 4.11 Exercises and Projects
-
Chapter 5 Tuples in C++ and their Applications
- 5.1 Introduction and Objectives
- 5.2 An std::pair Refresher and New Extensions
- 5.3 Mathematical and Computer Science Background
- 5.4 Tuple Fundamentals and Simple Examples
- 5.5 Advanced Tuples
- 5.6 Using Tuples in Code
- 5.7 Other Related Libraries
- 5.8 Tuples and Run-Time Efficiency
- 5.9 Advantages and Applications of Tuples
- 5.10 Summary and Conclusions
- 5.11 Exercises and Projects
-
Chapter 6 Type Traits, Advanced Lambdas and Multiparadigm Design in C++
- 6.1 Introduction and Objectives
- 6.2 Some Building Blocks
- 6.3 C++ Type Traits
- 6.4 Initial Examples of Type Traits
- 6.5 Generic Lambdas
- 6.6 How Useful will Generic Lambda Functions be in the Future?
- 6.7 Generalised Lambda Capture
- 6.8 Application to Stochastic Differential Equations
- 6.9 Emerging Multiparadigm Design Patterns: Summary
- 6.10 Summary and Conclusions
- 6.11 Exercises and Projects
- Chapter 7 Multiparadigm Design in C++
-
Chapter 8 C++ Numerics, IEEE 754 and Boost C++ Multiprecision
- 8.1 Introduction and Objectives
- 8.2 Floating-Point Decomposition Functions in C++
- 8.3 A Tour of std::numeric_limits<T>
- 8.4 An Introduction to Error Analysis
- 8.5 Example: Numerical Quadrature
- 8.6 Other Useful Mathematical Functions in C++
- 8.7 Creating C++ Libraries
- 8.8 Summary and Conclusions
- 8.9 Exercises and Projects
-
Chapter 9 An Introduction to Unified Software Design
- 9.1 Introduction and Objectives
- 9.2 Background
- 9.3 System Scoping and Initial Decomposition
- 9.4 Checklist and Looking Back
- 9.5 Variants of the Software Process: Policy-Based Design
- 9.6 Using Policy-Based Design for the DVM Problem
- 9.7 Advantages of Uniform Design Approach
- 9.8 Summary and Conclusions
- 9.9 Exercises and Projects
-
Chapter 10 New Data Types, Containers and Algorithms in C++ and Boost C++ Libraries
- 10.1 Introduction and Objectives
- 10.2 Overview of New Features
- 10.3 C++ std::bitset<N> and Boost Dynamic Bitset Library
- 10.4 Chrono Library
- 10.5 Boost Date and Time
- 10.6 Forwards Lists and Compile-Time Arrays
- 10.7 Applications of Boost.Array
- 10.8 Boost uBLAS (Matrix Library)
- 10.9 Vectors
- 10.10 Matrices
- 10.11 Applying uBLAS: Solving Linear Systems of Equations
- 10.12 Summary and Conclusions
- 10.13 Exercises and Projects
-
Chapter 11 Lattice Models Fundamental Data Structures and Algorithms
- 11.1 Introduction and Objectives
- 11.2 Background and Current Approaches to Lattice Modelling
- 11.3 New Requirements and Use Cases
- 11.4 A New Design Approach: A Layered Approach
- 11.5 Initial '101' Examples of Option Pricing
- 11.6 Advantages of Software Layering
- 11.7 Improving Efficiency and Reliability
- 11.8 Merging Lattices
- 11.9 Summary and Conclusions
- 11.10 Exercises and Projects
-
Chapter 12 Lattice Models Applications to Computational Finance
- 12.1 Introduction and Objectives
- 12.2 Stress Testing the Lattice Data Structures
- 12.3 Option Pricing Using Bernoulli Paths
- 12.4 Binomial Model for Assets with Dividends
- 12.5 Computing Option Sensitivities
- 12.6 (Quick) Numerical Analysis of the Binomial Method
- 12.7 Richardson Extrapolation with Binomial Lattices
- 12.8 Two-Dimensional Binomial Method
- 12.9 Trinomial Model of the Asset Price
- 12.10 Stability and Convergence of the Trinomial Method
- 12.11 Explicit Finite Difference Method
- 12.12 Summary and Conclusions
- 12.13 Exercises and Projects
- Chapter 13 Numerical Linear Algebra: Tridiagonal Systems and Applications
-
Chapter 14 Data Visualisation in Excel
- 14.1 Introduction and Objectives
- 14.2 The Structure of Excel-Related Objects
- 14.3 Sanity Check: Is the Excel Infrastructure Up and Running?
- 14.4 ExcelDriver and Matrices
- 14.5 ExcelDriver and Vectors
- 14.6 Path Generation for Stochastic Differential Equations
- 14.7 Summary and Conclusions
- 14.8 Exercises and Projects
- 14.9 Appendix: COM Architecture Overview
- 14.10 An Example
- 14.11 Virtual Function Tables
- 14.12 Differences Between COM and Object-Oriented Paradigm
- 14.13 Initialising the COM Library
-
Chapter 15 Univariate Statistical Distributions
- 15.1 Introduction, Goals and Objectives
- 15.2 The Error Function and its Universality
- 15.3 One-Factor Plain Options
- 15.4 Option Sensitivities and Surfaces
- 15.5 Automating Data Generation
- 15.6 Introduction to Statistical Distributions and Functions
- 15.7 Advanced Distributions
- 15.8 Summary and Conclusions
- 15.9 Exercises and Projects
-
Chapter 16 Bivariate Statistical Distributions and Two-Asset Option Pricing
- 16.1 Introduction and Objectives
- 16.2 Computing Integrals Using PDEs
- 16.3 The Drezner Algorithm
- 16.4 The Genz Algorithm and the West/Quantlib Implementations
- 16.5 Abramowitz and Stegun Approximation
- 16.6 Performance Testing
- 16.7 Gauss–Legendre Integration
- 16.8 Applications to Two-Asset Pricing
- 16.9 Trivariate Normal Distribution
- 16.10 Chooser Options
- 16.11 Conclusions and Summary
- 16.12 Exercises and Projects
- Chapter 17 STL Algorithms in Detail
-
Chapter 18 STL Algorithms Part II
- 18.1 Introduction and Objectives
- 18.2 Mutating Algorithms
- 18.3 Numeric Algorithms
- 18.4 Sorting Algorithms
- 18.5 Sorted-Range Algorithms
- 18.6 Auxiliary Iterator Functions
- 18.7 Needle in a Haystack: Finding the Right STL Algorithm
- 18.8 Applications to Computational Finance
- 18.9 Advantages of STL Algorithms
- 18.10 Summary and Conclusions
- 18.11 Exercises and Projects
-
Chapter 19 An Introduction to Optimisation and the Solution of Nonlinear Equations
- 19.1 Introduction and Objectives
- 19.2 Mathematical and Numerical Background
- 19.3 Sequential Search Methods
- 19.4 Solutions of Nonlinear Equations
- 19.5 Fixed-Point Iteration
- 19.6 Aitken's Acceleration Process
- 19.7 Software Framework
- 19.8 Implied Volatility
- 19.9 Solvers in the Boost C++ Libraries
- 19.10 Summary and Conclusions
- 19.11 Exercises and Projects
- 19.12 Appendix: The Banach Fixed-Point Theorem
-
Chapter 20 The Finite Difference Method for PDEs: Mathematical Background
- 20.1 Introduction and Objectives
- 20.2 General Convection–Diffusion–Reaction Equations and Black–Scholes PDE
- 20.3 PDE Preprocessing
- 20.4 Maximum Principles for Parabolic PDEs
- 20.5 The Fichera Theory
- 20.6 Finite Difference Schemes: Properties and Requirements
- 20.7 Example: A Linear Two-Point Boundary Value Problem
- 20.8 Exponentially Fitted Schemes for Time-Dependent PDEs
- 20.9 Richardson Extrapolation
- 20.10 Summary and Conclusions
- 20.11 Exercises and Projects
-
Chapter 21 Software Framework for One-Factor Option Models
- 21.1 Introduction and Objectives
- 21.2 A Software Framework: Architecture and Context
- 21.3 Modelling PDEs and Finite Difference Schemes: What is Supported?
- 21.4 Several Versions of Alternating Direction Explicit
- 21.5 A Software Framework: Detailed Design and Implementation
- 21.6 C++ Code for PDE Classes
- 21.7 C++ Code for FDM Classes
- 21.8 Examples and Test Cases
- 21.9 Summary and Conclusions
- 21.10 Exercises and Projects
-
Chapter 22 Extending the Software Framework
- 22.1 Introduction and Objectives
- 22.2 Spline Interpolation of Option Values
- 22.3 Numerical Differentiation Foundations
- 22.4 Numerical Greeks
- 22.5 Constant Elasticity of Variance Model
- 22.6 Using Software Design (GOF) Patterns
- 22.7 Multiparadigm Design Patterns
- 22.8 Summary and Conclusions
- 22.9 Exercises and Projects
-
Chapter 23 A PDE Software Framework in C++11 for a Class of Path-Dependent Options
- 23.1 Introduction and Objectives
- 23.2 Modelling PDEs and Initial Boundary Value Problems in the Functional Programming Style
- 23.3 PDE Preprocessing
- 23.4 The Anchoring PDE
- 23.5 ADE for Anchoring PDE
- 23.6 Useful Utilities
- 23.7 Accuracy and Performance
- 23.8 Summary and Conclusions
- 23.9 Exercises and Projects
-
Chapter 24 Ordinary Differential Equations and their Numerical Approximation
- 24.1 Introduction and Objectives
- 24.2 What is an ODE?
- 24.3 Classifying ODEs
- 24.4 A Palette of Model ODEs
- 24.5 Existence and Uniqueness Results
- 24.6 Overview of Numerical Methods for ODEs: The Big Picture
- 24.7 Creating ODE Solvers in C++
- 24.8 Summary and Conclusions
- 24.9 Exercises and Projects
- 24.9 Appendix
-
Chapter 25 Advanced Ordinary Differential Equations and Method of Lines
- 25.1 Introduction and Objectives
- 25.2 An Introduction to the Boost Odeint Library
- 25.3 Systems of Stiff and Non-stiff Equations
- 25.4 Matrix Differential Equations
- 25.5 The Method of Lines: What is it and what are its Advantages?
- 25.6 Initial Foray in Computational Finance: MOL for One-Factor Black–Scholes PDE
- 25.7 Barrier Options
- 25.8 Using Exponential Fitting of Barrier Options
- 25.9 Summary and Conclusions
- 25.10 Exercises and Projects
-
Chapter 26 Random Number Generation and Distributions
- 26.1 Introduction and Objectives
- 26.2 What is a Random Number Generator?
- 26.3 What is a Distribution?
- 26.4 Some Initial Examples
- 26.5 Engines in Detail
- 26.6 Distributions in C++: The List
- 26.7 Back to the Future: C-Style Pseudo-Random Number Generation
- 26.8 Cryptographic Generators
- 26.9 Matrix Decomposition Methods
- 26.10 Generating Random Numbers
- 26.11 Summary and Conclusions
- 26.12 Exercises and Projects
-
Chapter 27 Microsoft .Net, C# and C++11 Interoperability
- 27.1 Introduction and Objectives
- 27.2 The Big Picture
- 27.3 Types
- 27.4 Memory Management
- 27.5 An Introduction to Native Classes
- 27.6 Interfaces and Abstract Classes
- 27.7 Use Case: C++/CLI as 'Main Language'
- 27.8 Use Case: Creating Proxies, Adapters and Wrappers for Legacy C++ Applications
- 27.9 'Back to the Future' Use Case: Calling C# Code from C++11
- 27.10 Modelling Event-Driven Applications with Delegates
- 27.11 Use Case: Interfacing with Legacy Code
- 27.12 Assemblies and Namespaces for C++/CLI
- 27.13 Summary and Conclusions
- 27.14 Exercises and Projects
-
Chapter 28 C++ Concurrency, Part I Threads
- 28.1 Introduction and Objectives
- 28.2 Thread Fundamentals
- 28.3 Six Ways to Create a Thread
- 28.4 Intermezzo: Parallelising the Binomial Method
- 28.5 Atomics
- 28.6 Smart Pointers and the Thread-Safe Pointer Interface
- 28.7 Thread Synchronisation
- 28.8 When Should we use Threads?
- 28.9 Summary and Conclusions
- 28.10 Exercises and Projects
-
Chapter 29 C++ Concurrency, Part II Tasks
- 29.1 Introduction and Objectives
- 29.2 Finding Concurrency: Motivation
- 29.3 Tasks and Task Decomposition
- 29.4 Futures and Promises
- 29.5 Shared Futures
- 29.6 Waiting on Tasks to Complete
- 29.7 Continuations and Futures in Boost
- 29.8 Pure Functions
- 29.9 Tasks versus Threads
- 29.10 Parallel Design Patterns
- 29.11 Summary and Conclusions
- 29.12 Quizzes, Exercises and Projects
-
Chapter 30 Parallel Patterns Language (PPL)
- 30.1 Introduction and Objectives
- 30.2 Parallel Algorithms
- 30.3 Partitioning Work
- 30.4 The Aggregation/Reduction Pattern in PPL
- 30.5 Concurrent Containers
- 30.6 An Introduction to the Asynchronous Agents Library and Event-Based Systems
- 30.7 A Design Plan to Implement a Framework Using Message Passing and Other Approaches
- 30.8 Summary and Conclusions
- 30.9 Exercises and Projects
-
Chapter 31 Monte Carlo Simulation, Part I
- 31.1 Introduction and Objectives
- 31.2 The Boost Parameters Library for the Impatient
- 31.3 Monte Carlo Version 1: The Monolith Program ('Ball of Mud')
- 31.4 Policy-Based Design: Dynamic Polymorphism
- 31.5 Policy-Based Design Approach: CRTP and Static Polymorphism
- 31.6 Builders and their Subcontractors (Factory Method Pattern)
- 31.7 Practical Issue: Structuring the Project Directory and File Contents
- 31.8 Summary and Conclusions
- 31.9 Exercises and Projects
- Chapter 32 Monte Carlo Simulation, Part II
- Appendix 1 Multiple-Precision Arithmetic
-
Appendix 2 Computing Implied Volatility
- A2.1 Introduction and Objectives
- A2.2 Implied Volatility by Least-Squares Optimisation
- A2.3 Implied Volatility by Fixed-Point Iteration
- A2.4 Volatility by Homotopy and ODE Solvers
- A2.5 A Vector Space of Functions in C++
- A2.6 Multivariate Optimisation
- A2.7 Nonlinear Programming and Multivariable Optimisation
- A2.8 Nonlinear Least Squares
- A2.9 Summary and Conclusions
- A2.10 Exercises and Projects
- References
- Index
- EULA
Product information
- Title: Financial Instrument Pricing Using C++, 2nd Edition
- Author(s):
- Release date: October 2018
- Publisher(s): Wiley
- ISBN: 9780470971192
You might also like
book
Options and Derivatives Programming in C++: Algorithms and Programming Techniques for the Financial Industry
Learn how C++ is used in the development of solutions for options and derivatives trading in …
book
Financial Mathematics, Volatility and Covariance Modelling
This book provides a key repository on the current state of knowledge, the latest debates and …
book
Essentials of Time Series for Financial Applications
Essentials of Time Series for Financial Applications serves as an agile reference for upper level students …
book
Advanced Equity Derivatives: Volatility and Correlation
In Advanced Equity Derivatives: Volatility and Correlation, Sébastien Bossu reviews and explains the advanced concepts used …