《C++ Design Patterns and Derivatives Pricing》第二版--北美金融工程常用C++教材(附C++ Code)
本书将C++应用于Monte Carlo期权定价和Tree定价方法上,并且巧妙地将Quant面试中常问的Design Pattern融入了这些期权定价的代码设计中,使得本书的读者在学习知识的同时也大大增加了面试的能力。
作者:Mark Joshi
Product Description
Combining mathematical finance with C++ and object-oriented programming (00P), M. Joshi demonstrates the relevance and use of OOP in financial mathematics by describing how to use price derivatives to obtain reusable and extensible code. A large part of the book is devoted to designing reusable components which are then combined to build a Monte Carlo pricer for exotic equity derivatives. Readers knowing the basics of C++ and mathematical finance, but are unclear how to use OOP to implement models, will welcome this analysis.
Book Description
This is the first book that combines the areas of mathematical finance, C++, and object-oriented programming (OOP). The author shows shows the relevance and use of OOP to financial mathematics by describing how to price derivatives to obtain reusable and extensible code. Much of the book is devoted to designing reusable components which are then combined to build a Monte Carlo pricer for exotic equity derivatives. Those who know the basics of C++ and mathematical finance, but are unclear how to use OOP to implement models, will welcome this account.
Contents
1 A simple Monte Carlo model 11.1 Introduction 1
1.2 The theory 1
1.3 A simple implementation of a Monte Carlo call option pricer 2
1.4 Critiquing the simple Monte Carlo routine 7
1.5 Identifying the classes 9
1.6 What will the classes buy us? 10
1.7 Why object-oriented programming? 11
1.8 Key points 11
1.9 Exercises 12
2 Encapsulation 13
2.1 Implementing the pay-off class 13
2.2 Privacy 15
2.3 Using the pay-off class 16
2.4 Further extensibility defects 19
2.5 The open-closed principle 20
2.6 Key points 21
2.7 Exercises 22
3 Inheritance and virtual functions 23
3.1 ‘is a’ 23
3.2 Coding inheritance 24
3.3 Virtual functions 24
3.4 Why we must pass the inherited object by reference 29
3.5 Not knowing the type and virtual destruction 30
3.6 Adding extra pay-offs without changing files 34
3.7 Key points 37
3.8 Exercises 37
4 Bridging with a virtual constructor 384.1 The problem 38
4.2 A first solution 39
4.3 Virtual construction 43
4.4 The rule of three 51
4.5 The bridge 53
4.6 Beware of new 57
4.7 A parameters class 58
4.8 Key points 64
4.9 Exercises 64
5 Strategies, decoration and statistics 65
5.1 Differing outputs 65
5.2 Designing a statistics gatherer 65
5.3 Using the statistics gatherer 68
5.4 Templates and wrappers 72
5.5 A convergence table 76
5.6 Decoration 79
5.7 Key points 80
5.8 Exercises 80
6 A random numbers class 82
6.1 Why? 82
6.2 Design considerations 83
6.3 The base class 85
6.4 A linear congruential generator and the adapter
pattern 87
6.5 Anti-thetic sampling via decoration 92
6.6 Using the random number generator class 96
6.7 Key points 101
6.8 Exercises 101
7 An exotics engine and the template pattern 102
7.1 Introduction 102
7.2 Identifying components 103
7.3 Communication between the components 104
7.4 The base classes 106
7.5 A Black–Scholes path generation engine 110
7.6 An arithmetic Asian option 114
7.7 Putting it all together 116
7.8 Key points 119
7.9 Exercises 119
8 Trees 1218.1 Introduction 121
8.2 The design 123
8.3 The
TreeProduct class 1258.4 A tree class 129
8.5 Pricing on the tree 135
8.6 Key points 139
8.7 Exercises 139
9 Solvers, templates and implied volatilities 141
9.1 The problem 141
9.2 Function objects 142
9.3 Bisecting with a template 145
9.4 Newton–Raphson and function template
arguments 149
9.5 Using Newton–Raphson to do implied volatilities 151
9.6 The pros and cons of templatization 154
9.7 Key points 156
9.8 Exercises 156
10 The factory 157
10.1 The problem 157
10.2 The basic idea 157
10.3 The singleton pattern 158
10.4 Coding the factory 159
10.5 Automatic registration 162
10.6 Using the factory 165
10.7 Key points 166
10.8 Exercises 167
11 Design patterns revisited 168
11.1 Introduction 168
11.2 Creational patterns 168
11.3 Structural patterns 169
11.4 Behavioural patterns 170
11.5 Why design patterns? 171
11.6 Key points 172
11.7 Further reading 172
11.8 Exercises 173