Integration of Quantlib with Qgraph

QuantLib Introduction

QuantLib is aimed at providing a comprehensive software framework for quantitative finance. QuantLib is a free/open-source library for modeling,trading,and risk management in real-life. The following steps need to be followed to integrate quantlib with QSpace server on Ubuntu platform.

Downloading and Installing Quantlib

Boost Installation

If you don’t require a particular Boost version, the path of least resistance is to install the one packaged for your distribution; for instance, on Ubuntu you would execute:

QuantLib Installation

Installation from package repositories

If you don’t need to modify the library, you might want to skip the compilation and install a precompiled binary version; unofficial RPM and DEB packages should be available for your distribution through the usual channels. Note that the default version on Debian and Ubuntu distributions might be lagging behind; to get a recent one, use the “unstable” (a.k.a. “Sid”) distribution on Debian or Dirk Eddelbuettel’s PPA on Ubuntu. If you want to modify the library, instead, you’ll have to compile it yourself as described in the next section.

Installation from a released version

You can download released QuantLib versions from Bintray at QuantLib-1.4.1.tar.gz.

  • Once you have the tarball, extract it by executing:
  • (1.4.1 is the most recent version at the time of this writing; you might have downloaded another one.) This creates a folder QuantLib-1.4.1; enter it and configure QuantLib by executing:
  • The above step is customizable, run below command to obtain a list of the configuration options
    In particular, the –prefix option can be used to install QuantLib in a location other than the default (/usr/local). This is also the step where you might have to tell configure about the location of your Boost installation, if that’s not a standard one. If, for instance, you installed the Boost headers in /home/foo/include and the libraries in /home/foo/lib, execute:
  • To setup the build correctly.
    Finally, builds the library and installs it (if you specified a location with –prefix that doesn’t need admin permissions, you won’t need to use sudo before make install).
  • Depending on your system, you might also need to run below command
    to notify the dynamic linker that a new shared library is available. (The above works with the default prefix, /usr/local, on most system; if you chose another one, or if your programs still can’t find, you’ll need to add the location of the library to /etc/ before running ldconfig. For a default installation, that would be /usr/local/lib.)
  • Once you’re done, you can try to compile and run an example to check your installation. If you installed everything in the default location, you can simply execute:
    Otherwise, you’ll have to specify the location of your Boost and QuantLib installations with corresponding -I and -L flags; for instance, the middle step above would be:

Installation from a git repository

If you want to compile from a checkout of a git repository (such as the official one at quantlib, or a fork of it that you might have created) you’ll need an additional step at the beginning of the process. Before running the ./configure script, you’ll have to create it by executing ./ To do this, you’ll need automake, autoconf and libtool. Again, they’re packaged for most Linux distributions; on Ubuntu, you would get them by running sudo apt-get install automake autoconf libtool After the  execution of ./, the installation proceeds as in the previous section.

Integration Quantlib with QGraph server

Quantlib is used to compute the price of
  1. Equity option
  2. FX option and
  3. Swap in QSpace
To enable using Quantlib in QSpace it is controlled by environment variable “QS_ENABLE_QUANTLIB” in project’s /script/ file If QS_ENABLE_QUANTLIB environment variable is defined then server uses Quantlib mathematical model for compute the price of Equity Option, FX Option and Swap. Otherwise the server uses its own mathematical model to compute price of Equity Option, FX Option and Swap. Quantlib supports FX Option/ Equity Option models :
  • Black-Scholes
  • Heston semi-analytic
  • Bates semi-analytic
  • Barone-Adesi/Whaley
  • Bjerksund/Stensland
  • Integral
  • Finite differences
  • Binomial Jarrow-Rudd
  • Binomial Cox-Ross-Rubinstein
  • Additive equiprobabilities
  • Binomial Trigeorgis
  • Binomial Tian
  • Binomial Leisen-Reimer
  • Binomial Joshi
  • MC (crude)
  • QMC (Sobol)
  • MC (Longstaff Schwartz) Sample code using Jarrow-Rudd binomial method

Related Posts

Leave a Comment

Comment moderation is enabled. Your comment may take some time to appear.