Python for Finance

More Information
  • 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

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.

  • 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
Page Count 408
Course Length 12 hours 14 minutes
ISBN 9781783284375
Date Of Publication 24 Apr 2014


Yuxing Yan

Yuxing Yan graduated from McGill University with a PhD in finance. Over the years, he has been teaching various finance courses at eight universities: McGill University and Wilfrid Laurier University (in Canada), Nanyang Technological University (in Singapore), Loyola University of Maryland, UMUC, Hofstra University, University at Buffalo, and Canisius College (in the US).

His research and teaching areas include: market microstructure, open-source finance and financial data analytics. He has 22 publications including papers published in the Journal of Accounting and Finance, Journal of Banking and Finance, Journal of Empirical Finance, Real Estate Review, Pacific Basin Finance Journal, Applied Financial Economics, and Annals of Operations Research.

He is good at several computer languages, such as SAS, R, Python, Matlab, and C.

His four books are related to applying two pieces of open-source software to finance: Python for Finance (2014), Python for Finance (2nd ed., expected 2017), Python for Finance (Chinese version, expected 2017), and Financial Modeling Using R (2016).

In addition, he is an expert on data, especially on financial databases. From 2003 to 2010, he worked at Wharton School as a consultant, helping researchers with their programs and data issues. In 2007, he published a book titled Financial Databases (with S.W. Zhu). This book is written in Chinese.

Currently, he is writing a new book called Financial Modeling Using Excel — in an R-Assisted Learning Environment. The phrase "R-Assisted" distinguishes it from other similar books related to Excel and financial modeling. New features include using a huge amount of public data related to economics, finance, and accounting; an efficient way to retrieve data: 3 seconds for each time series; a free financial calculator, showing 50 financial formulas instantly, 300 websites, 100 YouTube videos, 80 references, paperless for homework, midterms, and final exams; easy to extend for instructors; and especially, no need to learn R.