In a previous article we presented how to build and install QuantLib so that it could be called in a Python script.

Here we introduce how to use QuantLib in a script that we already used in the past – though, a bit tweaked to get subplots instead of single charts – to produce some 3D charts of option sensitivities.

Below you will find the code of a class called QLAnalytics that returns a specific option figure (premium, delta, …).

As you can see we rely on  a file called which contains the following functions:

And finally we need a main script that call the QLOption() function contained in

Since we have to return several subplot, you’ll notice the use of a ShowChart() method that takes care of subplot and axis set up.

You will need the ImpliedVol.txt text file attached to this article.

Here is the chart generated by this script: