Python for Finance Training

Course Description

This course begins with an abbreviated primer on Python (language
syntax, data structures, basic data processing, Python functions,
modules and classes). The remainder of the course covers open source
Python tools relevant to solving your day-to-day financial programming
problems. Specific topics addressed include: array computation and
mathematics with NumPy; statistical computation with SciPy; working with
tabular data in Pandas to generate summary statistics and rolling window
calculations; and using libraries for numerical optimization. To
interface with the rest of your libraries, we teach ways of wrapping
C/C++ and/or Fortran code in Python, along with ways to compile Python
for dramatically improved performance. We will also cover how to call
Python functions from Excel, manipulate spreadsheets and documents using
Python, and expose your Python code over the web.

Course Length: 4 Days
Course Tuition: $1290 (US)

Prerequisites

Geared toward quantitative analysts and technology staff, Python for
Finance provides a strong foundation which will enable you to work and
prototype much more rapidly.

Course Outline

The course is taught over four days and covers the Python language and critical library modules for finance and engineering, including data visualization.

Introduction to Python.
The first section of the course is an introduction to the Python programming language. It introduces the details of how to start and stop the interpreter and write programs, and explains basic data-types, files, functions, and error handling.

Working with Data.
Section 2 provides a detailed tour of how to represent and work with data in Python. It covers tuples, lists, dictionaries, and sets, as well as NumPy arrays. Students will learn the critical aspects of Python's underlying object model including variables, reference counting, copying, and type checking and how to effectively use Python's very powerful list processing primitives. More information about how to organize larger programs into functions is provided in Section 3. A major focus is placed on design functions and the technical details of functions, including scoping rules and documentation strings.

Program Organization and Functions
More information about how to organize larger programs into functions is provided in Section 3. A major focus is placed on design functions and the technical details of functions, including scoping rules and documentation strings.

Modules and Libraries.
Section 4 addresses how to organize programs into modules and use those modules as a tool for creating extensible programs. It concludes with a tour of some of the most commonly used library modules including those related to system administration, text processing, subprocesses, XML parsing, binary data handling, and databases.

Classes and Objects.
In Section 5, students are given an introduction to object-oriented programming in Python. Topics such as how to create new objects, overload operators, and utilize Python special methods will be explained, along with the basic principles of object oriented programming including inheritance and composition.

NumPy.
NumPy is Python's array and mathematics library. Section 6 covers how one can and should use NumPy to simplify and speed up code. It starts with a brief overview of NumPy's memory model and teaches ways to slice and dice data using NumPy's sophisticated indexing operations. Mathematical use cases, various interpolation functions, matrix decompositions, computing eigenvalues, solving systems of equations and inverting matrices are also covered.

SciPy.
SciPy is Python's scientific complement to NumPy. SciPy is quite broad and used in many different domains. Section 7 covers key areas relevant to finance, starting with SciPy's statistical functions, how to generate different distributions and perform statistical computations. It also covers some interpolation, linear algebra, optimizations, signal processing, and fourier transforms. These are useful in efficiently computing some moving window functions (moving averages, exponential moving averages, bollinger bands).

Pandas.
Pandas is Python's answer to the R dataframe, which provides a very convenient way to work with tabular data. It helps organize your data by handling missing data and data alignment automatically. In Section 8, students learn about Pandas ability to do simple olap aggregations and drill downs without additional code, as well as executing efficient computations for statistical functions, like moving window functions and rolling regressions.

Integrating with Native Code.
Python is fantastic, but often we have to work with code in existing C/C++ libraries. One of the easiest ways to do this is with Python's built-in ctypes libraries, or if you can invest a little more, Cython - a Python to C compiler. Cython can be used to speed up Python code dramatically. In Section 9, students will examine several use cases that show how to write Python code first and optimize for speed later.

Production Python in Finance.
Python is fantastic for data analysis. One key feature allows users to go from quantitative analysis to a production application extremely rapidly. In Section 10, students will learn either how to wrap Python analysis code up in a web application for effortless deployment or to script in Excel using Python.

Numerical Optimization. One reason that quants love Matlab is that it makes it very easy to solve numerical optimization problems. We cover the main optimization libraries so you know what's out there, as well as teach you how to use them to solve real world problems.

Data Visualization.
Matplotlib is a Python visualization library which makes it easy to generate static plots. Section 12 will show students how to use Matplotlib to create basic line plots, scatter plots, density estimation plots, as well as date handling. If you have any specific plotting requirements, let us know and we can cover those use cases as well.