Python for Finance-review
Python for Finance
Author: Yuxing Yan
Published by Packt Publishing Ltd.
35 Livery Place
Birmingham, B3 2PB, UK
I received a copy of the e-book for review from the publisher.
This book is aimed at Finance professionals and/or students with an interest in options trading and portfolio composition and evaluation.
- Ch1 Introduction and Installation of Python
- Ch2 Using Python as an Ordinary Calculator
- Ch3 Using Python as a Financial Calculator
- Ch4 13 Lines of Python to Price a Call Option
- Ch5 Introduction to Modules
- Ch6 Introduction to Numpy Scipy
- Ch7 Visual Finance via Matplotlib
- Ch8 Statistical Analysis of Time Series
- Ch9 The Black-Scholes-Merton Option Model
- Ch10 Python Loops and Implied Volatility
- Ch11 Monte Carlo Simulation and Options
- Ch12 Volatility Measures and GARCH
The book takes a somewhat unique approach in interweaving Python concepts on an as needed basis with the introduction of progressively more advanced mathematics specific to the Finance field, primarily Options oriented.
I found the approach quite useful. In addition the book includes examples of retrieving financial data from a number of sources. specific code for retrieving data from Yahoo, Google, Federal Reserve and Prof French library is provided.
The introduction to NumPy, SciPy, and Matplotlib (graphing library) are quite well done with well chosen examples.
The book is a strong addition to the growing body of work for finance professionals who want to learn Python.
The book falls short in some of its more lofty goals including exploring Statsmodels and Pandas. And it has almost no mention of IPython notebook, which has rapidly become the default environment for many in the Finance field. Critically in my opinion, the book lacks a good explanation of the differences between floating point and integer arithmetic with its critical implications for Finance professionals.
To some degree this is to be expected since each of those topic areas is in fact subject to books of their own. That is, they are very large libraries and have numerous features that can and do interact with each other.
While the book does cover Pandas it’s usage examples are somewhat limited. The text does not point out how Pandas is built on top of Numpy/Scipy. It does not cover the use of resample to change frequency or offset to offset frequencies. Nor does it cover in much depth the extensive IO libraries built into Pandas, which provide cleaner access to many external data sources like Yahoo, Google the Federal Reserve as well as SQL databases. The coverage is limited to a subset of the CSV IO and some use of the Pickle module. Further there is no mention of the Pandas Dataframe Plotting capabilities.
Statsmodels, like Pandas is a newer Python library with rapidly expanding capabilities. Basic capabilities are nicely explained but more advanced capabilities are not. I was hoping to see some usage examples of some of the more advanced capabilities with explanations, but I admit that that is due to my own current frustration with figuring out some of those things myself.
Advanced Financial concepts such as, Time Series with Efficient frontier, Monte carlo simulation for options and GARCH are each well covered with good examples.
While some of the above sounds somewhat critical, I enjoyed the book and will keep it for quick reference, particularly for the Options valuation material. For those new to Python with a Finance interest, I would recommend the book highly, but I would augment it with additional Python material. The book is an excellent introduction and can provide a solid foundation for exploring the more advanced facilities of the various Python Financially oriented modules.