QuantLib With Python

QuantLib With Python

Introduction

QuantLib is a free open-source library for quantitative finance. For more information, please visit the official site. The aim of this site is to illustrate how the library can be used with python. As a start, please follow the instruction to install QuantLib python package from the official site.

The Documentation

The official documentation for QuantLib python wrappers is available here. For mere mortals such as myself, reading through the documentation is a daunting task. Unfortunately, while it is updated it is not sufficiently comprehensive. Member functions for some of the classes are not described in the python documentation but still accessible and the documentation describing these member functions is only available from www.quantlib.org. Unless one is a competent C++ and/or OOP programmer, the document may not make much sense.

A little help from samples and example codes are useful, at least at the early stage of learning about the library. Some of the resources for these examples are available and listed here.

The Purpose

The purpose of this site is simple - to illustrate the usage of the library with python and improve awareness on the library in the country o financial engineers including students, educators and finance professionals. Product knowledge is a prerequisite in all our examples. Python knowledge is also a prerequisite but one need not be an expert. The mathematics/theory behind the model used by QuantLib will not be explain either, though references might be made. Illustrations made will be step by step with instructions/explanations. Codes shown can be freely copied

The main hurdle, for finance professionals working in a financial institutions in the country, is the inability to download/install packages for python or even downloading/installing python itself on the company's computers for security reason. The next best solution to this is QuantLib AddIns which is much easier to get installation permission since the industry's standard spreadsheet in MS Excel. Guided usage of AddIns will be something we will add at a much later date.

The following are some tutorials that have been written so far.

Interest Rate Term Structure With QuantLib - Part 2

Guided steps to using QuantLib to create a single curve from a short and a long term curves. The resulting information is then presented in a table.

Author: Rosli Mohd Sani

Fixed Rate Bond with QuantLib

Guided steps to using QuantLib to review the coupon/cash flow structure, valuation and calculating the risk statistics.

Author: Rosli Mohd Sani

Fixed Rate Bond Valuation using QuantLib Spread

Guided steps to using QuantLib spread to revalue a fixed rate bond.

Author: Rosli Mohd Sani

Fitting A Curve To Bond Data

We show how to use Quantlib to fit a curve to Malaysian Government Securities last done yield on August 12 2020.

Author: Rosli Mohd Sani