Python for Finance
By Yuxing Yan
Publisher: Packt Publishing
Final Release Date: April 2014
Pages: 408

In Detail

Python is a free and powerful tool that can be used to build a financial calculator and price options, and can also explain many trading strategies and test various hypotheses. This book details the steps needed to retrieve time series data from different public data sources.

Python for Finance explores the basics of programming in Python. It is a step-by-step tutorial that will teach you, with the help of concise, practical programs, how to run various statistic tests. This book introduces you to the basic concepts and operations related to Python. You will also learn how to estimate illiquidity, Amihud (2002), liquidity measure, Pastor and Stambaugh (2003), Roll spread (1984), spread based on high-frequency data, beta (rolling beta), draw volatility smile and skewness, and construct a binomial tree to price American options.

This book is a hands-on guide with easy-to-follow examples to help you learn about option theory, quantitative finance, financial modeling, and time series using Python.


A hands-on guide with easy-to-follow examples to help you learn about option theory, quantitative finance, financial modeling, and time series using Python.

Who this book is for

Python for Finance is perfect for graduate students, practitioners, and application developers who wish to learn how to utilize Python to handle their financial needs. Basic programming knowledge is helpful, but not necessary.

Product Details
Recommended for You
Customer Reviews


by PowerReviews
oreillyPython for Finance

(based on 1 review)

Ratings Distribution

  • 5 Stars



  • 4 Stars



  • 3 Stars



  • 2 Stars



  • 1 Stars



Reviewed by 1 customer

Displaying review 1

Back to top

(5 of 5 customers found this review helpful)


Good but Basic

By Dartdog

from Birmingham, AL

About Me Developer

Verified Reviewer


  • Easy to understand
  • Helpful examples


  • Too basic

Best Uses

  • Novice
  • Student

Comments about oreilly Python for Finance:

Open SoftWare CompanyOswco: The Open SoftWare Company
about contact Teller Django_Pinax

Jun 03
Python for Finance-review
I received a copy of the e-book for review from the publisher.
Audience: This book is aimed at Finance professionals and/or students with an interest in options trading and portfolio composition and evaluation.
Python for Finance
It assumes no Python programming experience. The author primarily uses Windows as the platform of choice. The author primarily refers to Python 3.3, strangely there are no cautionary or explanatory notes on the differences and usage requirements between the Python 2.7 series and the 3.3 series. This may cause some serious confusion to people new to Python. While none of the code is platform specific, it is Python after all, using Windows makes the code examples and installation instructions somewhat easier to follow for Windows users and a large percentage of people in Financial institutions and students seem to be locked in to the Windows platform.

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.

Displaying review 1

Back to top

Buy 2 Get 1 Free Free Shipping Guarantee
Buying Options
Immediate Access - Go Digital what's this?
Ebook: $26.99
Formats:  ePub, Mobi, PDF