Jump to ratings and reviews
Rate this book

Python for Finance

Rate this book
Build real-life Python applications for quantitative finance and financial engineering with this book and ebook

Overview
Estimate market risk, form various portfolios, and estimate their variance-covariance matrixes using real-world data
Explains many financial concepts and trading strategies with the help of graphs
A step-by-step tutorial with many Python programs that will help you learn how to apply Python to finance
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.

What you will learn from this book

Build a financial calculator based on Python
Learn how to price various types of options such as European, American, average, lookback, and barrier options
Write Python programs to download data from Yahoo! Finance
Estimate returns and convert daily returns into monthly or annual returns
Form an n-stock portfolio and estimate its variance-covariance matrix
Estimate VaR (Value at Risk) for a stock or portfolio
Run CAPM (Capital Asset Pricing Model) and the Fama-French 3-factor model
Learn how to optimize a portfolio and draw an efficient frontier
Conduct various statistic tests such as T-tests, F-tests, and normality tests
Approach

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.

321 pages, Paperback

First published January 1, 2014

31 people are currently reading
104 people want to read

About the author

Yuxing Yan

5 books1 follower

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
8 (28%)
4 stars
6 (21%)
3 stars
11 (39%)
2 stars
2 (7%)
1 star
1 (3%)
Displaying 1 - 9 of 9 reviews
5 reviews4 followers
May 22, 2018
While it is a great introduction to Python for finance practicioners, much of the code is extremely inefficient. Although they introduce pandas for data manipulation, they fail to use most of the pandas features for computing things like price differences, volatility, etc; relying instead on heavy use of indexing the raw numpy arrays.
Profile Image for Enrique Mañas.
Author 5 books50 followers
February 11, 2024
The book provides a decent overview of some financial terms and how to work with Python. Keep in mind that most libraries are heavily deprecated, so they will not work (for instance, all of them retrieving stock information from APIs like Google or Yahoo).

Otherwise, it can bring a decent amount of knowledge for programmers seeking to expand their financial foundations, or reversely, finance adepts looking to improve their programming skills.
Profile Image for Gaudencio Guedes.
39 reviews
October 11, 2020
Decent book for those who are just taking their first steps on python and are looking ways to apply it in their day jobs (like myself). It’s a good introduction to python programming, but I think there’s better options out there for the same purpose. The financial exercises were interesting, but some of the codes were outdated (yahoo IPA). I might be coming back to this book at a later stage of my learning development.
Profile Image for Gábor Bakos.
Author 3 books
January 5, 2019
There are too many repetitions for my taste, but it was good to get familiar with the different products. The typesetting in the Kindle version is not very good unfortunately.
Profile Image for Seth Kenlon.
Author 10 books11 followers
May 16, 2014
A really amazing book in an unexpected way. I don't know anything about Finances or Economics or stock quotes or market trends, and I don't much care about those things, but I am fascinated about ingesting and parsing and processing data. So the stated point of this book is mostly irrelevant; the real take-away ends up being a lot of lessons on how to use Python better.

The book jumps right in to both worlds that it covers; it doesn't do much by way of explaining Python or the jargon of the financial sector, so it's for somewhat experienced users. It also does little to allow for the fact that Python is a cross-platform language, with all of its examples and screenshots coming from Windows. Not really a big deal, but a point of contention since I use Linux exclusively and frankly prefer to see examples in a free OS.

The most useful information in this book, at least for me, were the insights on processing arrays of numbers and formulating complex equations and how they look in Python. Some of the graphs and figures the author is able to generate from fairly short code blocks is just astonishing.

Python modules covered in detail are math (including pi and e), NumPy, SciPy, and matplotlib. Python packaging options are also given a little time, so the user will know exactly where to go look for new modules later on, once their Python skills have improved beyond the usual collection of modules we all learn initially.

The thing about programming is that so much of it boils down to parsing data. If you can't do that with alacrity, then you'll be spending a lot of time trying to figure out how to deal with all the data your programme is supposed to be dealing with instead of actually writing the programme. The better you can get with data sets, the better; doesn't matter whether you're programming a game or a system utility or graphic calculator. This book will show you new ways to deal with arrays of numbers and streams of data.

Highly recommended.
Profile Image for Arthur.
97 reviews6 followers
June 4, 2014
I picked Python in Finance from Packt Publishing to review expecting to bore myself with complex algorithms and senseless formulas while seeing little actual Python in action, indeed at 400 pages plus it may seem so. But, it turned out to be quite the opposite. I learned a lot about practical implementations of various Python modules as SciPy, NumPy and several more, I think they empower a developer a lot. No wonder Python is on the track to become a de-facto scientist language of choice! But I am not going to compromise the truth, the book does discuss numerous financial terms, many of them, and this is where the enormous power of this book is coming from: it is like standing on the shoulders of a giant. Python is that giant - flexible and powerful, yet very approachable. The TOC is very detailed thanks to Packt, any one can see what financial algorithms are covered, I am only going to name a few which I had most fun with (though all of them are covered in enough details): Fama*, Fat Tail, ARCH, Monte-Carlo and of course the volatility smile!

I am under an impression this book is best suited for students in Finance, especially those who are about to join the workforce, but I suspect the material in this book is very well suited for mature Financists, an investor who has some programming skills and wants to benefit from it, or even a programmer, or a mathematician who already knows Python or any other language, but wants to have fun in Quantitative Finance and earn a few buck!

Pure fun, real results, tons of practical insight from reading data from a file to downloading trade data from Yahoo!

Lastly, I need to complement Yuxing – he is a talented teacher, this book could not be what it is otherwise.

It is a 5 out of 5 product.

Disclaimer: I received a free copy of this book for review purposes from the publisher.
Profile Image for Bill Jones.
72 reviews2 followers
May 12, 2014
Python for Finance

While I am not a python expert and I'm learning various uses for the language, I do use other languages such as C++, PHP, and Javascript. I am not really into Finance so I decided to get this book and do a review on it, later in the book and I mean at the near end there is a algorithm for highs and lows, and the author say's let's pull data from Dell but still uses the IBM tag, it was something that just made me chuckle, but some others out there may not find it funny. The book walks you over getting everything setup and creating a nice working environment, I found this section extremely well written and everything worked as intended.

To simply dismiss this book because the author uses a 3rd party library is rather critical, why should you re-invent the wheel to get something done, using something tested, tried, and true is not an issue for me and allows me to embrace new concepts. The author may not have detailed every line of code that you are working with but this isn't a learn Python step-by-step book, it is however using python with finance and the models employed in the book are well written and worked perfectly, as described on the publisher site: "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." I was very satisfied with this, new into the stock market and wondering what all the jumble means is difficult, but having formulas or tweaking items based on my financial needs is well worth it.

Publisher Link: http://www.packtpub.com/python-for-fi...
21 reviews1 follower
June 30, 2014
Review - "Python for Finance" by Yuxing Yan from Packt

Finished reading the book.

This book focuses more on finance than Python which is a good thing. Books on Python are available easily, when we are focusing on using Python for Finance the focus should be on explaining the financial concepts rather than the implementation. The book starts with basics of Python but quickly moves on to financial concepts. We learn to use python as a financial calculator and to price a call option. It then quickly movoes on to shows us how to use the matplotlib module to vividly explain many financial concepts by using graphs, pictures, color, and size, expaining important python concepts like modules in the process. We then dive into further advanced topics like statistical analysis of time series, Black-scholes-merton option model, monte-carlo simulations and volatility measures.

If you are a graduate student major in finance, especially studying computational finance, financial modeling, financial engineering, and business analytics, this book will benefit you. If you are a professional, you could learn Python and use it in many financial projects. If you are an individual investor, you could benefit from reading this book as well.

Get the book here - http://www.packtpub.com/python-for-fi...
Profile Image for Luis Cuellar.
1 review
June 2, 2014
I am a systems engineer but have not program for a long time, and I am very interested in finance so I have been studying finance for the past months.

For me this book is perfect, it teaches you python witch to me is a very powerful language witch you can learn fast and do very sophisticated things. and it teaches it with a very specific focus witch is applying it to Financial problems.

The examples of the book are very well done, and helps ground your financial knowledge by programming the examples.The book takes you from installing the language to complicated graphical and mathematical solutions. The examples are well written and to the point.

The only negative I find is the book assumes you know finance, so it is a programming book more that a financial book. But for me that was just fine.
Displaying 1 - 9 of 9 reviews

Can't find what you're looking for?

Get help and learn more about the design.