![](https://csdnimg.cn/release/download_crawler_static/88426225/bg10.jpg)
operations and their trading and investment performances. At the beginning of 2018,
the first dedicated book on “financial machine learning” was published, which under‐
scores this trend. Without a doubt, there are more to come. This leads to what might
be called AI-first finance, where flexible, parameterizable ML and DL algorithms
replace traditional financial theory—theory that might be elegant but no longer very
useful in the new era of data-driven, AI-first finance.
Python is the right programming language and ecosystem to tackle the challenges of
this era of finance. Although this book covers basic ML algorithms for unsupervised
and supervised learning (as well as deep neural networks, for instance), the focus is
on Python’s data processing and analysis capabilities. To fully account for the impor‐
tance of AI in finance—now and in the future—another book-length treatment is
necessary. However, most of the AI, ML, and DL techniques require such large
amounts of data that mastering data-driven finance should come first anyway.
This second edition of Python for Finance is more of an upgrade than an update. For
example, it adds a complete part (Part IV) about algorithmic trading. This topic has
recently become quite important in the financial industry, and is also quite popular
with retail traders. It also adds a more introductory part (Part II) where fundamental
Python programming and data analysis topics are presented before they are applied
in later parts of the book. On the other hand, some chapters from the first edition
have been deleted completely. For instance, the chapter on web techniques and pack‐
ages (such as Flask) was dropped because there are more dedicated and focused
books about such topics available today.
For the second edition, I tried to cover even more finance-related topics and to focus
on Python techniques that are particularly useful for financial data science, algorith‐
mic trading, and computational finance. As in the first edition, the approach is a
practical one, in that implementation and illustration come before theoretical details
and I generally focus on the big picture rather than the most arcane parameterization
options of a certain class, method, or function.
Having described the basic approach for the second edition, it is worth emphasizing
that this book is neither an introduction to Python programming nor to finance in
general. A vast number of excellent resources are available for both. This book is
located at the intersection of these two exciting fields, and assumes that the reader
has some background in programming (not necessarily Python) as well as in finance.
Such readers learn how to apply Python and its ecosystem to the financial domain.
The Jupyter Notebooks and codes accompanying this book can be accessed and exe‐
cuted via our Quant Platform. You can sign up for free at http://py4fi.pqp.io.
My company (The Python Quants) and myself provide many more resources to mas‐
ter Python for financial data science, artificial intelligence, algorithmic trading, and
computational finance. You can start by visiting the following sites:
xiv | Preface