Book review: Python for Finance: Analyze Big Financial Data

Recently, I moved to the finance industry. As usually when I start in a new domain, I look at the Python books for it. And Python for Finance from Yves Hilpisch is one of the most known ones.

Discussion

The book is split in 3 unequal parts. The first one is short and presents the usage of Python in the finance industry, how to install it and a few example of its usage for finance. The Python code is quite simple, strangely the author decided to go for global variables and almost no parameters. Why not presenting classes here? At least he uses examples through IPython/Jupyter, so that’s good!

The second part tackles finance applications to Python and the useful modules. Obviously, the first chapter here handles Numpy. I liked the fact that vectorization is an important part here (not using explicit loops). Then of course an important point is visualizing plot, and especially time series. The third chapter tackles pandas, a library that was originally written for finance analysis, so obviously it has to be used!

Strangely, the chapter after that one is about reading and writing data. I’m not really sure it is worth spending so much time on some functions that are already in numpy and pandas. I agree that I/O is important, but I’m not sure it deserves so much space in a Python book. Or even talk about SQL.

The next chapter tackles performance in Python. The author compares different ways of make your code faster. I liked the IPython example, as lots of people would work from Jupyter with several available cores behind. The multiprocessing module is nice, but can sometimes be… awkward to use. Not sure that the NumbaPro example was useful, as not many people will be able to use them (I felt this was more an ad than actually useful pages).

After this chapter, we are back to math tools for finance. The strange part is that the previous chapter may not really be used for this chapter. Not many algorithms can be efficiently parallelized when they come out of available packages (except when they are meant for this like sklearn pipeline model). So the chapter here will talk about regression (one of the main tool to understand a trend in time series; although the prediction may be completely bogus), interpolation or optimization. The latter one is what you need for lots of models. Later in the chapter, symbolic computation is also introduced, and I have to say that if you know an analytical approach to a problem, then this is quite effective (I always take a similar route for my electronic models).

The tenth chapter dives into the core of finance maths with stochastic equations (and the Black-Scholes one!). Of course here, it’s basically using random number generators, and then applying some rules on top of them. The chapter after that handles puts several of the previous topics together, like normality test for stats, or portfolio optimization for… optimization. There is a part on PCA, but I’m biased, I hate PCA since lots of people use it for dimensionality reduction on data that is not Euclidian…

There is also a chapter on Excel, probably because lots of people use it to analyze data, and you need to be able to exchange data with it. I guess.

And then, the chapter where the author finally tackles classes!! Really!! And by saying that it’s an important aspect of Python. That’s what I don’t understand. Especially the way it’s presented. The part with traits is OK, although the online tutorials are just as good.

Then, there is a chapter on web apps, not sure exactly why there is, to be franc.

After this part with ups and down, there is a part on creating a derivative library. This is the part where there is some real finance computation, although the author refers back to his other book for the theory itself. The chapters are quite small and try to wrap everything from the previous part in a unique framework.

I just wish this integration was done in the second part instead.

Conclusion

So basically the content of the book is on some kind of Python. If you don’t know about finance, you want to know much more at the end of this book. But if want to learn about Python, you will know about modules, but actually not about good Python.

So unfortunately, avoid.

Leave a Reply