PyQL : a new set of Python wrappers for QuantLib

March 23, 2012

Hi folks,

We are happy to announce the release of PyQL [1], a new set of Python wrappers for QuantLib.

The project is available here :

* URL: http://github.com/enthought/pyql
* License: BSD license.
* Authors: Didrik Pinte, Enthought and Patrick Henaff, IAE Paris.

Why another set of Python wrappers for QuantLib?

The SWIG wrappers provide a very good coverage of the library but have
a number of pain points:

  •   few Pythonic optimisation in the syntax: the code a user must writeon the Python side looks like the C++ version
  • no docstring or function signature available on the Python side
  • complex debugging and complex customization of the wrappers
  • monolithic build process
  • complete loss of the C++ code organisation with a flat namespace in Python
  • SWIG typemaps development is not that fun

For those reasons and to have the ability to expose some of the
QuantLib internals that could be very useful on the Python side, we
chosed another road. PyQL is build on top of Cython and creates a thin
Pythonic layer on top of QuantLib. It allows a tight control on the
wrapping and provides higher level Python integration.

Features:

  1. Integration with standard datatypes (like datetime objects) and numpy arrays
  2. Simplifed API on the Python side (e.g. usage of Handles completely hidden from the user)
  3. Support full docstring and expose detailed function signatures to Python
  4. Code organised in subpackages to provide a decent namespace, very close to the C++ code organisation
  5. Easy extendibility thanks to Cython and shorter build time when adding new functionnalities
  6. Sphinx documentation

It supports QuantLib >= 1.1 and currently builds very nicely on MacOSX
and Linux. The Windows builds will be there soon. Regarding the build
process, make sure you read the build instruction!
(Cython 0.15 needs a simple patch available in the repo)

The library comes with a decent test suite and many examples: from the
very basic option valuation to more complex heston model calibration
within an IPython notebook.

For more details, take a look at the code, contact the authors, or
discuss on the list!

We are looking forward questions, comments, contributions.

[1] The name is still subject to modification as PyQL is already used
by other projects unrelated to QuantLib. Suggestions are welcome!

Advertisements

Sniffing RS232 traffic with python

July 4, 2008

Today, I had to check that traffic between an embedded java application (in an eWON 4101) and a Coronis WavePort modem was following a given rule (less than 10 milliseconds between the bytes).

I have used a great thing : the SpyCable. It allowed me to monitor either the send traffic or the received one using two serial ports. I’ve then written a small python script to monitor the bytes entering the port,  printing Coronis frames with time information if some bytes were written with more than 10 milliseconds interval.
Read the rest of this entry »