Python for Finance: Analyze Big Financial Data

(Elle) #1

Conclusions


Python provides, in combination with NumPy, a rich set of flexible data structures. From a


finance point of view, the following can be considered the most important ones:


Basic data types


In finance, the classes int, float, and string provide the atomic data types.


Standard data structures


The classes tuple, list, dict, and set have many application areas in finance, with


list being the most flexible workhorse in general.


Arrays


A large class of finance-related problems and algorithms can be cast to an array


setting; NumPy provides the specialized class numpy.ndarray, which provides both


convenience and compactness of code as well as high performance.


This chapter shows that both the basic data structures and the NumPy ones allow for highly


vectorized implementation of algorithms. Depending on the specific shape of the data


structures, care should be taken with regard to the memory layout of arrays. Choosing the


right approach here can speed up code execution by a factor of two or more.

Free download pdf