QuantLib Py

  • QuantLib since 2000, an open-source C++ library for quantitative finance
  • Non-copylefted free Software released under the modified BSD License. i.e. the free software and you are allowed to use, copy, modify, merge, publish, distribute, and/or sell copies of it under the conditions stated in the QuantLib License.
  • We’ll be using its python binding. It’s a quick way to get started with QuantLib. For that, Python is a goto language.
  • API names are same for C++ version of QuantLib so, you can translate your python code to C++. See QuantLib official C++ documentation.

Basics


Installation

  • If you’re using conda package manager, you can install it by running the following command in your terminal:
conda install pip &&  pip install QuantLib
  • If you’re already using pip package manager, you can install it by running the following command in your terminal:
pip install QuantLib

Usage

import QuantLib as ql      # Import QuantLib module

Note that in-order to shorten the length of a code-line, I will not write ql. in this cheat sheet. For example: instead of writing ql.Date, I will simply write Date. If you want to do the same thing in your code, you need to use: from QuantLib import *. But, it is usually considered as a bad practice.


Permalink at https://www.physicslog.com/cs-notes/quantlibpy

Published on Jan 13, 2023

Last revised on Jul 2, 2023

References