C++ code

Code from Schlögl, E. (2013) Quantitative Finance: An Object-oriented Approach in C++, 1st edition, Chapman & Hall/CRC Financial Mathematics Series. Taylor and Francis, Florida, USA.

This page gives an overview of and download links for the C++ code discussed in the book Quantitative Finance: An Object-Oriented Approach in C++, including additional C++ source files and examples. Please note that the code made available on this site is provided under a Modified BSD License (other licenses may apply for code on external sites).

Requisite third-party libraries

The C++ code discussed in the book makes extensive use of the Boost and Blitz++ libraries, which must be installed in order to compile the code.

Please note that Blitz++ currently does not work with Microsoft Visual Studio Express 2013; please use Microsoft Visual Studio Express 2012 instead (see below).

The current version of Blitz++ is 0.10, while the version used in the book is 0.9. Two header file names have changed from version 0.9 to 0.10. In order for the code from the book to compile with Blitz++ version 0.10, in the “blitz” folder of Blitz++ 0.10, please copy the file tinyvec2.h to tinyvec-et.h and the file tinymat2.h to tinymat.h. Also, if using Microsoft Visual Studio, please follow the installation instructions in the file README-VS.NET.txt, supplied with the Blitz++ distribution (the instructions apply to Microsoft Visual Studio 2010, but also work for Microsoft Visual Studio 2012).

Compilation using Microsoft Visual Studio

Solution files are provided for compiling and linking the C++ code using Microsoft Visual Studio Express 2012. These solution files assume that the Boost libraries have been installed in C:\Lib\boost_1_52_0 and the Blitz++ library has been installed in C:\Lib\blitz-0.9 - if these libraries are installed in a different location, the search paths have to be amended accordingly.

XLW example

The XLW example discussed in Appendix A.1 of the book is included in a modified XLW distribution. The modified XLW distribution is found in the folder “Third party distributions” in the ZIP archive below, and the example itself (including the Microsoft Visual Studio Express 2012 solution file) is in the folder “Third party distributions\xlw-5.0.1f0\xlw\examples\Start Here - Example\vc11”. Building this solution results in the XLL “Third party distributions\xlw-5.0.1f0\xlw\examples\Start Here - Example\vc11\Release\ESXLWProject.xll”. A spreadsheet demonstrating the use of this XLL is found under “Spreadsheets/XLWExamples.xlsm”.

QuantLib ObjectHandler example

The QuantLib ObjectHandler example discussed in Appendix A.2 of the book is included in the folder “ObjectHandlerQFExample” in the ZIP archive below, with the solution and project files for Microsoft Visual C++ 2012 (updated from the 2010 version mentioned in the book). To build the example, the following is required:

  • Check that Python 2.7 is installed.
  • Download and unzip the QuantLib components gensrc, log4cxx and ObjectHandler - see the download instructions here.
  • Copy the folders gensrc, log4cxx and ObjectHandler into same folder, i.e. so that they are each subfolders of that same folder (the example project provided in the ZIP archive below assumes that this is “C:\Lib”; if this is changed then include and library paths will have to be changed accordingly in the example).
  • Open and build “ObjectHandler/ObjectHandler_vc11.sln” (note that you may have to add the path to the Boost header files to the “include” path and the path to the Boost .lib files to the “library” path of some of the projects in this solution.
  • Now you can build “ObjectHandlerQFExample/ExampleXllStatic_vc11.sln”

Code download

Current version of the code available for download below. Updates will be announced on this page.

Download: QuantFinCode version 1.05