新加坡大学金融研究生学习资料
Modern C++ for MBAs and Masters of Finance Singapore Management University
(英文,可编辑的pdf电子文档)
Textbook:Learning Modern C++ for Finance: Foundations for Quantitative Programming
Author(s): Daniel Hanson
Description:
This practical coursebook demonstrates why C++ is still one of the dominant production-quality languages for financial applications and systems. Many programmers believe that C++ is too difficult to learn. Author Daniel Hanson demonstrates that this is no longer the case, thanks to modern features added to the C++ Standard beginning in 2011.
Financial programmers will discover how to leverage C++ abstractions that enable safe implementation of financial models. You'll also explore how popular open source libraries provide additional weapons for attacking mathematical problems. C++ programmers unfamiliar with financial applications also benefit from this handy guide.
• Learn C++ basics from a modern perspective: syntax, inheritance, polymorphism, composition, STL containers, and algorithms
• Dive into newer features and abstractions including functional programming using lambdas, task-based concurrency, and smart pointers
• Implement basic numerical routines in modern C++
• Understand best practices for writing clean and efficient code
•• Chapter 1, “An Overview of C++” provides an overview of C++, beginning with
a brief history of C++ in finance, and the shift toward modern C++, beginning with C++11. It also covers the separation of the core language and the C++ Standard Library, followed by key modern updates to the language that will be used throughout the remainder of the book, such as automatic type deduction, range-based for loops, scoped enumerations, and lambda expressions. It also includes coverage of basic mathematical features within the core language and the Standard Library. It concludes with a discussion about coding style and standards, and those that will be followed in this book.
•• Chapter 2, “Writing User-Defined Classes with Modern C++ Features” and Chapter 3, “Inheritance, Polymorphism, and Smart Pointers” are focused on object-oriented features in C++, and modern additions that have changed (and have helped improve) the methods once commonly employed in C++ for imple‐ menting composition and inheritance. Chapter 2 is primarily concerned with composition, namely the storage of a private data member that is itself an object, and how move semantics introduced in C++11 can make this more efficient by avoiding object copy at construction of the enclosing object. It also covers the new C++20 three-way operator (also called the spaceship operator), which greatly streamlines implementation of equality and inequality operators. Chapter 3 begins with modern features that better facilitate inheritance and
dynamic polymorphism. It then shifts back to composition, where the subobject member is now a pointer resource, and how smart pointers help eliminate the problems associated with raw pointers. Composition and inheritance are then tied together in a modern context where the resource is a smart pointer to a polymorphic object. Financial examples in both chapters are related to option pricing.
•• Chapter 4, “The Standard Template Library Part I: Containers and Iterators” and Chapter 5, “The Standard Template Library Part II: Algorithms and Ranges” cover what has traditionally been called the Standard Template Library (STL). This is a set of standard containers—including the vector container and oth‐ ers—plus iterators that allow you to traverse these containers, and algorithms that perform operations on elements in a container. STL containers and iterators are covered in Chapter 4, while the algorithms are covered in Chapter 5. Chap‐ ter 5 also contains a discussion of C++20 and C++23 extensions of algorithms in the more expressive form of ranges, and furthermore how ranges relate to range views and range adaptors. As you will see, these can be used in a functional programming context for composing a sequence of algorithms such that the performance overhead from copying data and generating temporary container objects can be avoided.
•• Chapter 6, “Random Number Generation and Concurrency” begins with a dis‐ cussion of random number generation from known probability distributions, another new Standard Library feature released in C++11. Standard normal ran‐ dom variates in particular are key to continuous-time financial models, while the random values from a Poisson distribution are often used in modeling tick data for testing live trading strategies. Two examples are presented. The first is the shuffle algorithm combined with a C++11 random engine to generated Monte Carlo scenarios of equity lines to measure the risk associated with the volatility of maximum drawdown in a trading strategy. The second is a Monte Carlo model for valuing European options with barriers, where random variates from a standard normal distribution are used in a discretized Brownian motion process. The chapter then changes focus to concurrency and parallelism, first with examples of parallel STL algorithms, introduced with C++17. These are mostly overloads of existing algorithms, but with an additional execution policy parameter, which means significant performance increases can be had by simply including an extra argument. The chapter concludes with a return to the Monte Carlo option pricing example, but using the Standard Library async(.) function and future class, which help facilitate generating each Monte Carlo scenario as a parallel task, again resulting in significant increases in the magnitude of speed for larger numbers of scenarios and time steps.
• Chapter 7, “Dates and Fixed Income Securities” introduces the new C++20 date functionality in the Standard Library, and how date functions and validations typically required for fixed income trading can be incorporated into code. Dis‐ cussion then proceeds to wrapping this functionality in a user-defined date class that can be used in the design of a yield curve class and a bond class, and how these can all be used together to price a coupon-paying bond. This includes coverage of potentially tedious but important details that are crucial for fixed income trading but are often left out of related textbooks and course syllabi.
•• Chapter 8, “Linear Algebra” is devoted to linear algebra in C++. A common technique used in C++ linear algebra library development is expression template programming, so a gentle introduction to this topic is provided before moving on to the open source, third-party C++ linear algebra library called Eigen. This will include applications to fund tracking (regression), valuing basket options (Cholesky decomposition), and yield curve dynamics (principle component decomposition). The chapter concludes with a look ahead to linear algebra capa‐ bilities in the C++ Standard Library, particularly the mdspan multidimensional array reference from C++23, and the standard interface based on the Basic Linear Algebra Subprograms (BLAS) slated for C++26.
•• Chapter 9, “The Boost Libraries” covers some of the peer-reviewed, open source Boost libraries. A fair amount of content from Boost has found its way into the C++ Standard over the years (in similar but not necessarily identical form), while other Boost libraries remain orthogonal to the Standard but can be applied to problems that arise in finance. In particular, the set of statistical distributions from the Boost Math Toolkit library provides the probability density function (PDF), cumulative distribution function (CDF), and percentile function for each of 34 “textbook” distributions. The Boost MultiArray library provides a generic multidimensional array that can be adapted for binomial (and trinomial) lattice option pricing models, and the Boost Accumulators library contains efficient incremental descriptive statistical computations on dynamic sets of data that are well suited for keeping track of performance metrics in trading backtests. Each of these is covered in the chapter.
Modern C++ for Finance_ Foundations for Quantitative Programming.pdf
(3.81 MB, 需要: RMB 19 元)


雷达卡



京公网安备 11010802022788号







