Financial Instrument Pricing Using C++ (eBook)
John Wiley & Sons (Verlag)
978-1-119-17048-8 (ISBN)
This 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.
Full source code is available by registering at www.datasimfinancial.com.
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.
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.
An integrated guide to C++ and computational finance This 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.
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
riverrun, past Eve and Adam's, from swerve of shore to bend of bay, brings us by a commodius vicus of recirculation back to Howth Castle and Environs
—Joyce (1939)
1.1 Introduction and Objectives
This book is the second edition of Financial Instrument Pricing Using C++, also written by the author (Duffy, 2004B). The most important reason for writing this hands-on book is to reflect the many changes and improvements to the C++ language, in particular due to the announcement of the new standard C++11 (and to a lesser extent C++14 and C++17). It feels like a new language compared to C++03 and in a sense it is. First, C++11 improves and extends the syntax of C++03. Second, it has become a programming language that supports the functional programming model in addition to the object-oriented and generic programming models.
We apply modern C++ to design and implement applications in computational finance, in particular option pricing problems using partial differential equation (PDE)/finite difference method (FDM), Monte Carlo and lattice models. We show the benefits of using C++11 compared to similar solutions in C++03. The resulting code tends to be more maintainable and extendible, especially if the software system has been properly designed. We recommend spending some time on designing the software system before jumping into code and to this end we include a defined process to take a problem description, design the problem and then implement it in such a way that it results in a product that satisfies the requirements and that is delivered on time and within budget.
This book is a detailed exposition of the language features in C++, how to use these features and how to design applications in computational finance. We discuss modern numerical methods to price plain and American options and the book is written in a hands-on, step-by-step fashion.
1.2 What is C++?
C++ is a general-purpose systems programming language that was originally designed as an extension to the C programming language. Its original name was ‘C with classes' and its object-oriented roots can be traced to the programming language Simula which was one of the first object-oriented languages. C++ was standardised by the International Organization for Standardization (ISO) in 1998 (called the C++03 standard) and C++14 is the standard at the moment of writing. It can be seen as a minor extension to C++11 which is a major update to the language.
C++ was designed primarily for applications in which performance, efficiency and flexibility play a vital role. In this sense it is a systems programming language and early applications in the 1990s were in telecommunications, embedded systems, medical devices and Computer Aided Design (CAD) as well as first-generation option pricing risk management systems in computational finance. The rise in popularity continued well into the late 1990s as major vendors such as Microsoft, Sun and IBM began to endorse object-oriented technology in general and C++ in particular. It was also in this period that the Java programming language appeared which in time became a competitor to C++.
C++ remains one of the most important programming languages at the moment of writing. It is evolving to support new hardware such as multicore processors, GPUs (graphics processing units) and heterogeneous computing environments. It also has a number of mathematical libraries that are useful in computational finance applications.
1.3 C++ As a Multiparadigm Programming Language
We give an overview of the programming paradigms that C++ supports. In general, a programming paradigm is a way to classify programming languages according to the style of computer programming. Features of various programming languages determine which programming paradigms they belong to. C++ is a multiparadigm programming language because it supports the following styles:
- Procedural: organises code around functions, as typically seen in programs written in C, FORTRAN and COBOL. The style is based on structured programming in which a function or program is decomposed into simpler functions.
- Object-oriented: organises code around classes. A class is an abstract entity that encapsulates functions and data into a logical unit. We instantiate a class to produce objects. Furthermore, classes can be grouped into hierarchies. It is probably safe to say that this style is the most popular one in the C++ community.
- Generic/template: templates are a feature of C++ that allow functions and classes to operate with generic types. A function or class can then work on different data types.
- Functional: treats computation as the evaluation of mathematical functions. It is a declarative programming paradigm; this means that programming is done with expressions and declarations instead of statements. The output value of a function depends only on its input arguments.
The generic programming style is becoming more important and pronounced in C++, possibly at the expense of the traditional object-oriented model which is based on class hierarchies and subtype (dynamic) polymorphism. Template code tends to perform better at run-time while many errors are caught at compile-time, in contrast to object-oriented code where the errors tend to be caught by the linker or even at run-time.
The most recent style that C++ has (some) support for is functional programming. This style predates both structured and object-oriented programming. Functional programming has its origins in lambda calculus, a formal system developed by Alonzo Church in the 1930s to investigate computability, function definition, function application and recursion. Many functional programming languages can be viewed as elaborations on the lambda calculus. C++ supports the notion of lambda functions. A lambda function in C++ is an unnamed function but it has all the characteristics of a normal function. Here is an example of defining a stored lambda function (which we can define in place in code) and we then call it as a normal function:
// TestLambda101.cpp // // Simple example of a lambda function // // (C) Datasim Education BV 2018 // // #include <iostream> #include <string> int main() { // Captured variable std::string cVar("Hello"); // Stored lambda function, with captured variable auto hello = [&cVar](const std::string& s) { // Return type automatically deduced std::cout << cVar << " " << s << '/n'; }; // Call the stored lambda function hello(std::string("C")); hello(std::string("C++")); return 0; }In this case we see that the lambda function has a formal input string argument and it uses a captured variable cVar
. Lambda functions are simple but powerful and we shall show how they can be used in computational finance.
C++11 is a major improvement on C++03 and it has a number of features that facilitate the design of software systems based on a combination of Structured Analysis and object-oriented technology. In general, we have a defined process to decompose a system into loosely coupled subsystems (Duffy, 2004). We then implement each subsystem in C++11. We discuss this process in detail in this book.
1.4 The Structure and Contents of this Book: Overview
This book examines C++ from a number of perspectives. In this sense it differs from other C++ literature because it discusses the full software lifecycle, starting with the problem description and eventually producing a working C++ program. In this book the topics are based on numerical analysis and its applications to computational finance (in particular, option pricing). In order to design and implement maintainable and efficient software systems we discuss each of the following building blocks in detail:
- A1: The new and improved syntax and language features in C++.
- A2: Integrating object-oriented, generic and functional programming styles in C++ code.
- A3: Replacing and upgrading the traditional Gang-of-Four software design patterns to fit into a multiparadigm design methodology.
- A4: Analysing and designing large and complex software systems using a combination of top-down system decomposition and bottom-up object assembly.
- A5: When writing applications, determining how much of the features in A1, A2, A3 and A4 to use.
The chapters can be categorised into those that deal with modern C++ syntax and language features, those that focus on system design and finally those chapters that discuss applications. In general, the first ten chapters introduce new language features. Chapters 11 to 19 focus on using C++ to create numerical libraries, visualisation software in Excel and lattice option pricing code. Chapters 20 to 29 are devoted to the finite difference method on the one hand and to multithreading and parallel processing on the other hand. The last three chapters of the book deal with Monte Carlo methods. For easy reference, we give a one-line summary of each chapter in the book:
- Smart pointers, move semantics, r-value references.
- All...
Erscheint lt. Verlag | 5.9.2018 |
---|---|
Reihe/Serie | Wiley Finance |
Wiley Finance Editions | Wiley Finance Editions |
Sprache | englisch |
Themenwelt | Informatik ► Office Programme ► Outlook |
Mathematik / Informatik ► Informatik ► Software Entwicklung | |
Recht / Steuern ► Wirtschaftsrecht | |
Wirtschaft ► Betriebswirtschaft / Management ► Finanzierung | |
Schlagworte | Boost C++ libraries • C++11 • C++ Black Scholes equations • C++ in finance • C++ libraries • C++ modelling • Computational Finance • C++ with Excel and C# interoperability • Daniel J. Duffy • Datasim Education • Finance & Investments • finance modelling • finance programming • Financial Engineering • Financial Instrument Pricing Using C++ 2nd Edition with full source code • Finanztechnik • Finanz- u. Anlagewesen • Gang of Four Design Patterns rewritten and extended • improved instrument pricing • instrument pricing • next generation C++ design patterns • Nonlinear pricing models • parallel processing and multithreading • pricing accuracy • Pricing Models • state-of-the-art C++ Finite Difference methods |
ISBN-10 | 1-119-17048-6 / 1119170486 |
ISBN-13 | 978-1-119-17048-8 / 9781119170488 |
Haben Sie eine Frage zum Produkt? |
Größe: 4,4 MB
Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM
Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belletristik und Sachbüchern. Der Fließtext wird dynamisch an die Display- und Schriftgröße angepasst. Auch für mobile Lesegeräte ist EPUB daher gut geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine
Geräteliste und zusätzliche Hinweise
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich