
P1: JYS
c02 JWBK378-Fletcher May 1, 2009 19:51 Printer: Yet to come
6 Financial Modelling in Python
market/
math/
model/
hull
white/
lattice/
monte
carlo/
pricer/
payoffs/
test/
utility/
Here is a brief summary of the nature and main roles of each of the ppf sub-packages:
com COM servers wrapping ppf market, trade and pricing functionality (see
Chapter 12).
core Types and functions relating to the representation of financial quantities such
as flows and LIBOR rates.
date
time Date and time manipulation and computations.
market Types and functions for the representation of common curves and surfaces
that arise in financial programming such as discount factor curves and
volatility surfaces.
math General mathematical algorithms.
model Code specific to implementing numerical pricing models.
pricer Types and functions for the purpose of valuing financial structures.
text The ppf unit test suite.
utility Utilities of a less numerical, general nature such as algorithms for searching
and sorting.
2.2 UNIT TESTING
Code in the ppf library employs two approaches to testing: interactive Python session testing
using the doctest module and formalised unit testing using the PyUnit module. Both of
these testing frameworks are part of the Python standard libraries.
2.2.1 doctest
The way that the doctest module works is to search a module for pieces of text that
look like interactive Python sessions, and then to execute those sessions ...