Financial Instrument Pricing Using C++
Inbunden, Engelska, 2018
Av Daniel J. Duffy, Daniel J. (Datasim Education BV) Duffy, Daniel J Duffy
1 269 kr
Produktinformation
- Utgivningsdatum2018-09-14
- Mått178 x 252 x 58 mm
- Vikt1 882 g
- SpråkEngelska
- SerieWiley Finance
- Antal sidor1 168
- Upplaga2
- FörlagJohn Wiley & Sons Inc
- EAN9780470971192
Tillhör följande kategorier
DANIEL J. DUFFY started the company Datasim in 1987 to promote C++ as a new object-oriented language for developing applications in the roles of developer, architect and requirements analyst to help clients design and analyse software systems for Computer Aided Design (CAD), process control and hardware- software systems, logistics, holography (optical technology) and computational finance. He used a combination of top-down functional decomposition and bottom-up object-oriented programming techniques to create stable and extendible applications. Prior to Datasim, he worked on engineering and financial applications in oil and gas and semiconductor industries using a range of numerical methods (for example, the finite element method [FEM]) on mainframe and mini-computers. Duffy has BA (Mod), MSc and PhD degrees in pure, numerical and applied mathematics and has been active in promoting partial differential equation (PDE) and finite difference methods (FDM) to applications in computational finance. He was responsible for the introduction of the Fractional Step ("Soviet Splitting") method and the Alternating Direction Explicit (ADE) method in computational finance. He is the originator of two very popular and leading C++ online courses (both C++98 and C++11/14/17) on www.quantnet.com in cooperation with Quantnet LLC and Baruch College (CUNY), NYC. He also trains quants, developers and designers around the world. Duffy can be contacted at dduffy@datasim.nl. In his spare time, he tries to keep in shape by workouts in the dojo.
- CHAPTER 1 A Tour of C++ and Environs 11.1 Introduction and Objectives 11.2 What is C++? 11.3 C++ as a Multiparadigm Programming Language 21.4 The Structure and Contents of this Book: Overview 41.5 A Tour of C++11: Black–Scholes and Environs 61.6 Parallel Programming in C++ and Parallel C++ Libraries 121.7 Writing C++ Applications; Where and How to Start? 141.8 For whom is this Book Intended? 161.9 Next-Generation Design and Design Patterns in C++ 161.10 Some Useful Guidelines and Developer Folklore 171.11 About the Author 181.12 The Source Code and Getting the Source Code 19CHAPTER 2 New and Improved C++ Fundamentals 212.1 Introduction and Objectives 212.2 The C++ Smart Pointers 212.3 Using Smart Pointers in Code 232.4 Extended Examples of Smart Pointers Usage 302.5 Move Semantics and Rvalue References 342.6 Other Bits and Pieces: Usability Enhancements 392.7 Summary and Conclusions 522.8 Exercises and Projects 52CHAPTER 3 Modelling Functions in C++ 593.1 Introduction and Objectives 593.2 Analysing and Classifying Functions 603.3 New Functionality in C++: std::function<> 643.4 New Functionality in C++: Lambda Functions and Lambda Expressions 653.5 Callable Objects 693.6 Function Adapters and Binders 703.7 Application Areas 753.8 An Example: Strategy Pattern New Style 753.9 Migrating from Traditional Object-Oriented Solutions: Numerical Quadrature 783.10 Summary and Conclusions 813.11 Exercises and Projects 82CHAPTER 4 Advanced C++ Template Programming 894.1 Introduction and Objectives 894.2 Preliminaries 914.3 decltype Specifier 944.4 Life Before and After decltype 1014.5 std::result_of and SFINAE 1064.6 std::enable_if 1084.7 Boost enable_if 1124.8 std::decay()Trait 1144.9 A Small Application: Quantities and Units 1154.10 Conclusions and Summary 1184.11 Exercises and Projects 118CHAPTER 5 Tuples in C++ and their Applications 1235.1 Introduction and Objectives 1235.2 An std:pair Refresher and New Extensions 1235.3 Mathematical and Computer Science Background 1285.4 Tuple Fundamentals and Simple Examples 1305.5 Advanced Tuples 1305.6 Using Tuples in Code 1335.7 Other Related Libraries 1385.8 Tuples and Run-Time Efficiency 1405.9 Advantages and Applications of Tuples 1425.10 Summary and Conclusions 1435.11 Exercises and Projects 143CHAPTER 6 Type Traits, Advanced Lambdas and Multiparadigm Design in C++ 1476.1 Introduction and Objectives 1476.2 Some Building Blocks 1496.3 C++ Type Traits 1506.4 Initial Examples of Type Traits 1586.5 Generic Lambdas 1616.6 How Useful will Generic Lambda Functions be in the Future? 1646.7 Generalised Lambda Capture 1716.7.1 Living Without Generalised Lambda Capture 1736.8 Application to Stochastic Differential Equations 1746.9 Emerging Multiparadigm Design Patterns: Summary 1786.10 Summary and Conclusions 1796.11 Exercises and Projects 179CHAPTER 7 Multiparadigm Design in C++ 1857.1 Introduction and Objectives 1857.2 Modelling and Design 1857.3 Low-Level C++ Design of Classes 1907.4 Shades of Polymorphism 1997.5 Is there More to Life than Inheritance? 2067.6 An Introduction to Object-Oriented Software Metrics 2077.7 Summary and Conclusions 2107.8 Exercises and Projects 210CHAPTER 8 C++ Numerics, IEEE 754 and Boost C++ Multiprecision 2158.1 Introduction and Objectives 2158.2 Floating-Point Decomposition Functions in C++ 2198.3 A Tour of std::numeric_limits 2218.4 An Introduction to Error Analysis 2238.5 Example: Numerical Quadrature 2248.6 Other Useful Mathematical Functions in C++ 2288.7 Creating C++ Libraries 2318.8 Summary and Conclusions 2398.9 Exercises and Projects 239CHAPTER 9 An Introduction to Unified Software Design 2459.1 Introduction and Objectives 2459.1.1 Future Predictions and Expectations 2469.2 Background 2479.3 System Scoping and Initial Decomposition 2519.4 Checklist and Looking Back 2599.5 Variants of the Software Process: Policy-Based Design 2609.6 Using Policy-Based Design for the DVM Problem 2689.7 Advantages of Uniform Design Approach 2739.8 Summary and Conclusions 2749.9 Exercises and Projects 275CHAPTER 10 New Data Types, Containers and Algorithms in C++ and Boost C++ Libraries 28310.1 Introduction and Objectives 28310.2 Overview of New Features 28310.3 C++ std::bitset and Boost Dynamic Bitset Library 28410.4 Chrono Library 28810.5 Boost Date and Time 30110.6 Forwards Lists and Compile-Time Arrays 30610.7 Applications of Boost.Array 31110.8 Boost uBLAS (Matrix Library) 31310.9 Vectors 31610.10 Matrices 31810.11 Applying uBLAS: Solving Linear Systems of Equations 32210.12 Summary and Conclusions 33010.13 Exercises and Projects 331CHAPTER 11 Lattice Models Fundamental Data Structures and Algorithms 33311.1 Introduction and Objectives 33311.2 Background and Current Approaches to Lattice Modelling 33411.3 New Requirements and Use Cases 33511.4 A New Design Approach: A Layered Approach 33511.5 Initial ‘101’ Examples of Option Pricing 34711.6 Advantages of Software Layering 34911.7 Improving Efficiency and Reliability 35211.8 Merging Lattices 35511.9 Summary and Conclusions 35711.10 Exercises and Projects 357CHAPTER 12 Lattice Models Applications to Computational Finance 36712.1 Introduction and Objectives 36712.2 Stress Testing the Lattice Data Structures 36812.3 Option Pricing Using Bernoulli Paths 37212.4 Binomial Model for Assets with Dividends 37412.5 Computing Option Sensitivities 37712.6 (Quick) Numerical Analysis of the Binomial Method 37912.7 Richardson Extrapolation with Binomial Lattices 38212.8 Two-Dimensional Binomial Method 38212.9 Trinomial Model of the Asset Price 38412.10 Stability and Convergence of the Trinomial Method 38512.11 Explicit Finite Difference Method 38612.12 Summary and Conclusions 38912.13 Exercises and Projects 389CHAPTER 13 Numerical Linear Algebra: Tridiagonal Systems and Applications 39513.1 Introduction and Objectives 39513.2 Solving Tridiagonal Matrix Systems 39513.3 The Crank-Nicolson and Theta Methods 40613.4 The ADE Method for the Impatient 41113.5 Cubic Spline Interpolation 41513.6 Some Handy Utilities 42713.7 Summary and Conclusions 42813.8 Exercises and Projects 429CHAPTER 14 Data Visualisation in Excel 43314.1 Introduction and Objectives 43314.2 The Structure of Excel-Related Objects 43314.3 Sanity Check: Is the Excel Infrastructure Up and Running? 43514.4 ExcelDriver and Matrices 43714.5 ExcelDriver and Vectors 44414.6 Path Generation for Stochastic Differential Equations 44814.7 Summary and Conclusions 45914.8 Exercises and Projects 45914.9 Appendix: COM Architecture Overview 46314.10 An Example 46814.11 Virtual Function Tables 47114.12 Differences between COM and Object-Oriented Paradigm 47314.13 Initialising the COM Library 474CHAPTER 15 Univariate Statistical Distributions 47515.1 Introduction, Goals and Objectives 47515.2 The Error Function and Its Universality 47515.3 One-Factor Plain Options 47815.4 Option Sensitivities and Surfaces 48815.5 Automating Data Generation 49115.6 Introduction to Statistical Distributions and Functions 49915.7 Advanced Distributions 50415.8 Summary and Conclusions 51115.9 Exercises and Projects 511CHAPTER 16 Bivariate Statistical Distributions and Two-Asset Option Pricing 51516.1 Introduction and Objectives 51516.2 Computing Integrals Using PDEs 51616.3 The Drezner Algorithm 52116.4 The Genz Algorithm and the West/Quantlib Implementations 52116.5 Abramowitz and Stegun Approximation 52516.6 Performance Testing 52816.7 Gauss–Legendre Integration 52916.8 Applications to Two-Asset Pricing 53116.9 Trivariate Normal Distribution 53616.10 Chooser Options 54316.11 Conclusions and Summary 54516.12 Exercises and Projects 546CHAPTER 17 STL Algorithms in Detail 55117.1 Introduction and Objectives 55117.2 Binders and std::bind 55417.3 Non-modifying Algorithms 55717.4 Modifying Algorithms 56717.5 Compile-Time Arrays 57517.6 Summary and Conclusions 57617.7 Exercises and Projects 57617.8 Appendix: Review of STL Containers and Complexity Analysis 583CHAPTER 18 STL Algorithms Part II 58918.1 Introduction and Objectives 58918.2 Mutating Algorithms 58918.3 Numeric Algorithms 59718.4 Sorting Algorithms 60118.5 Sorted-Range Algorithms 60418.5.5 Merging 60818.6 Auxiliary Iterator Functions 60918.7 Needle in a Haystack: Finding the Right STL Algorithm 61218.8 Applications to Computational Finance 61318.9 Advantages of STL Algorithms 61318.10 Summary and Conclusions 61418.11 Exercises and Projects 614CHAPTER 19 An Introduction to Optimisation and the Solution of Nonlinear Equations 61719.1 Introduction and Objectives 61719.2 Mathematical and Numerical Background 61819.3 Sequential Search Methods 61919.4 Solutions of Nonlinear Equations 62019.5 Fixed-Point Iteration 62219.6 Aitken’s Acceleration Process 62319.7 Software Framework 62319.8 Implied Volatility 63219.9 Solvers in the Boost C++ Libraries 63219.10 Summary and Conclusions 63319.11 Exercises and Projects 63319.12 Appendix: The Banach Fixed-Point Theorem 636CHAPTER 20 The Finite Difference Method for PDEs: Mathematical Background 64120.1 Introduction and Objectives 64120.2 General Convection–Diffusion–Reaction Equations and Black–Scholes PDE 64120.3 PDE Preprocessing 64520.3.2 Reduction of PDE to Conservative Form 64620.4 Maximum Principles for Parabolic PDEs 64920.5 The Fichera Theory 65020.6 Finite Difference Schemes: Properties and Requirements 65420.7 Example: A Linear Two-Point Boundary Value Problem 65520.8 Exponentially Fitted Schemes for Time-Dependent PDEs 65920.9 Richardson Extrapolation 66320.10 Summary and Conclusions 66520.11 Exercises and Projects 666CHAPTER 21 Software Framework for One-Factor Option Models 66921.1 Introduction and Objectives 66921.2 A Software Framework: Architecture and Context 66921.3 Modelling PDEs and Finite Difference Schemes: What is Supported? 67021.4 Several Versions of Alternating Direction Explicit 67121.5 A Software Framework: Detailed Design and Implementation 67321.6 C++ Code for PDE Classes 67421.7 C++ Code for FDM Classes 67921.8 Examples and Test Cases 69021.9 Summary and Conclusions 69321.10 Exercises and Projects 694CHAPTER 22 Extending the Software Framework 70122.1 Introduction and Objectives 70122.2 Spline Interpolation of Option Values 70122.3 Numerical Differentiation Foundations 70422.4 Numerical Greeks 71022.5 Constant Elasticity of Variance Model 71522.6 Using Software Design (GOF) Patterns 71522.7 Multiparadigm Design Patterns 72022.8 Summary and Conclusions 72122.9 Exercises and Projects 721CHAPTER 23A PDE Software Framework in C++11 for a Class of Path-Dependent Options 72723.1 Introduction and Objectives 72723.2 Modelling PDEs and Initial Boundary Value Problems in the Functional Programming Style 72823.3 PDE Preprocessing 73123.4 The Anchoring PDE 73223.5 ADE for Anchoring PDE 73923.6 Useful Utilities 74623.7 Accuracy and Performance 74823.8 Summary and Conclusions 75023.9 Exercises and Projects 751CHAPTER 24 Ordinary Differential Equations and their Numerical Approximation 75524.1 Introduction and Objectives 75524.2 What is an ODE? 75524.3 Classifying ODEs 75624.4 A Palette of Model ODEs 75724.5 Existence and Uniqueness Results 76024.6 Overview of Numerical Methods for ODEs: The Big Picture 76324.7 Creating ODE Solvers in C++ 77024.8 Summary and Conclusions 77624.9 Exercises and Projects 77624.10 Appendix 778CHAPTER 25 Advanced Ordinary Differential Equations and Method of Lines 78125.1 Introduction and Objectives 78125.2 An Introduction to the Boost Odeint Library 78225.3 Systems of Stiff and Non-stiff Equations 79125.4 Matrix Differential Equations 79625.5 The Method of Lines: What is it and what are its Advantages? 79925.6 Initial Foray in Computational Finance: MOL for One-Factor Black-Scholes PDE 80125.7 Barrier Options 80625.8 Using Exponential Fitting of Barrier Options 80825.9 Summary and Conclusions 80825.10 Exercises and Projects 809CHAPTER 26 Random Number Generation and Distributions 81926.1 Introduction and Objectives 81926.2 What is a Random Number Generator? 82026.3 What is a Distribution? 82126.4 Some Initial Examples 82526.5 Engines in Detail 82726.6 Distributions in C++: The List 83026.7 Back to the Future: C-Style Pseudo-Random Number Generation 83126.8 Cryptographic Generators 83326.9 Matrix Decomposition Methods 83326.10 Generating Random Numbers 84526.11 Summary and Conclusions 84826.12 Exercises and Projects 849CHAPTER 27 Microsoft .Net, C# and C++11 Interoperability 85327.1 Introduction and Objectives 85327.2 The Big Picture 85427.3 Types 85827.4 Memory Management 85927.5 An Introduction to Native Classes 86127.6 Interfaces and Abstract Classes 86127.7 Use Case: C++/CLI as ‘Main Language’ 86227.8 Use Case: Creating Proxies, Adapters and Wrappers for Legacy C++ Applications 86427.8.1 Alternative: SWIG (Simplified Wrapper and Interface Generator) 87127.9 ‘Back to the Future’ Use Case: Calling C# Code from C++11 87227.10 Modelling Event-Driven Applications with Delegates 87627.11 Use Case: Interfacing with Legacy Code 88627.12 Assemblies and Namespaces for C++/CLI 88927.13 Summary and Conclusions 89527.14 Exercises and Projects 896CHAPTER 28 C++ Concurrency, Part I Threads 89928.1 Introduction and Objectives 89928.2 Thread Fundamentals 90028.3 Six Ways to Create a Thread 90328.4 Intermezzo: Parallelising the Binomial Method 90928.5 Atomics 91628.6 Smart Pointers and the Thread-Safe Pointer Interface 92428.7 Thread Synchronisation 92628.8 When should we use Threads? 92928.9 Summary and Conclusions 92928.10 Exercises and Projects 930CHAPTER 29 C++ Concurrency, Part II Tasks 93529.1 Introduction and Objectives 93529.2 Finding Concurrency: Motivation 93629.3 Tasks and Task Decomposition 93729.4 Futures and Promises 94129.5 Shared Futures 94529.6 Waiting on Tasks to Complete 94829.7 Continuations and Futures in Boost 95029.8 Pure Functions 95229.9 Tasks versus Threads 95329.10 Parallel Design Patterns 95329.11 Summary and Conclusions 95529.12 Quizzes, Exercises and Projects 955CHAPTER 30 Parallel Patterns Language (PPL) 96130.1 Introduction and Objectives 96130.2 Parallel Algorithms 96230.3 Partitioning Work 96730.4 The Aggregation/Reduction Pattern in PPL 97130.5 Concurrent Containers 97730.6 An Introduction to the Asynchronous Agents Library and Event-Based Systems 97830.7 A Design Plan to Implement a Framework Using Message Passing and Other Approaches 98630.8 Summary and Conclusions 98930.9 Exercises and Projects 990CHAPTER 31 Monte Carlo Simulation, Part I 99331.1 Introduction and Objectives 99331.2 The Boost Parameters Library for the Impatient 99531.3 Monte Carlo Version 1: The Monolith Program (‘Ball of Mud’) 100031.4 Policy-Based Design: Dynamic Polymorphism 100331.5 Policy-Based Design Approach: CRTP and Static Polymorphism 101131.6 Builders and their Subcontractors (Factory Method Pattern) 101331.7 Practical Issue: Structuring the Project Directory and File Contents 101431.8 Summary and Conclusions 101631.9 Exercises and Projects 1017CHAPTER 32 Monte Carlo Simulation, Part II 102332.1 Introduction and Objectives 102332.2 Parallel Processing and Monte Carlo Simulation 102332.3 A Family of Predictor–Corrector Schemes 103332.4 An Example (CEV Model) 103832.5 Implementing the Monte Carlo Method Using the Asynchronous Agents Library 104132.6 Summary and Conclusions 104732.7 Exercises and Projects 1050Appendix 1: Multiple-Precision Arithmetic 1053Appendix 2: Computing Implied Volatility 1075References 1109Index 1117