Python for Finance
Yves Hilpisch
Beijing Cambridge Farnham Kln Sebastopol Tokyo
Preface
Not too long ago, Python
as a programming language and platform technology was considered exotic if not completely irrelevant in the financial industry. By contrast, in 2014 there are many examples of large financial institutions like Bank of America Merrill Lynch with its Quartz project, or JP Morgan Chase with the Athena project that strategically use Python
alongside other established technologies to build, enhance, and maintain some of their core IT systems. There is also a multitude of larger and smaller hedge funds that make heavy use of Python
s capabilities when it comes to efficient financial application development and productive financial analytics efforts.
Similarly, many of todays Master of Financial Engineering programs (or programs awarding similar degrees) use Python
as one of the core languages for teaching the translation of quantitative finance theory into executable computer code. Educational programs and trainings targeted to finance professionals are also increasingly incorporating Python
into their curricula. Some now teach it as the main implementation language.
There are many reasons why Python
has had such recent success and why it seems it will continue to do so in the future. Among these reasons are its syntax, the ecosystem of scientific and data analytics libraries available to developers using Python, its ease of integration with almost any other technology, and its status as open source. (See for a few more insights in this regard.)
For that reason, there is an abundance of good books available that teach Python
from different angles and with different focuses. This book is one of the first to introduce and teach Python
for finance in particular, for quantitative finance and for financial analytics. The approach is a practical one, in that implementation and illustration come before theoretical details, and the big picture is generally more focused on than the most arcane parameterization options of a certain class or function.
Most of this book has been written in the powerful, interactive, browser-based IPython Notebook
environment (explained in more detail in ). This makes it possible to provide the reader with executable, interactive versions of almost all examples used in this book.
Those who want to immediately get started with a full-fledged, interactive financial analytics environment for Python
(and, for instance, R
and Julia
) should go to http://oreilly.quant-platform.com and try out the Python Quant Platform (in combination with the IPython Notebook
files and code that come with this book). You should also have a look at DX
analytics, a Python
-based financial analytics library. My other book, Derivatives Analytics with Python (Wiley Finance), presents more details on the theory and numerical methods for advanced derivatives analytics. It also provides a wealth of readily usable Python
code. Further material, and, in particular, slide decks and videos of talks about Python
for Quant Finance can be found on my private website.
If you want to get involved in Python
for Quant Finance community events, there are opportunities in the financial centers of the world. For example, I myself (co)organize meetup groups with this focus in London (cf. http://www.meetup.com/Python-for-Quant-Finance-London/) and New York City (cf. http://www.meetup.com/Python-for-Quant-Finance-NYC/). There are also For Python Quants conferences and workshops several times a year (cf. http://forpythonquants.com and http://pythonquants.com).
I am really excited that Python
has established itself as an important technology in the financial industry. I am also sure that it will play an even more important role there in the future, in fields like derivatives and risk analytics or high performance computing. My hope is that this book will help professionals, researchers, and students alike make the most of Python
when facing the challenges of this fascinating field.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, and email addresses.
Constant width
Used for program listings, as well as within paragraphs to refer to software packages, programming languages, file extensions, filenames, program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
Tip
This element signifies a tip or suggestion.
Warning
This element indicates a warning or caution.
Using Code Examples
Supplemental material (in particular, IPython Notebooks and Python scripts/modules) is available for download at http://oreilly.quant-platform.com.
This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless youre reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: Python for Finance by Yves Hilpisch (OReilly). Copyright 2015 Yves Hilpisch, 978-1-491-94528-5.
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .
Safari Books Online
Note
Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the worlds leading authors in technology and business.
Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.
Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals.
Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like OReilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.
How to Contact Us
Please address comments and questions concerning this book to the publisher: