What this book covers
Chapter 1, Python Basics, offers a short introduction, and explains how to install Python, how to launch and quit Python, variable assignment, vector, matrix and Tuple, calling embedded functions, write your own functions, input data from an input file, simple data manipulations, output our data and results, and generate a Python dataset with an extension of pickle.
Chapter 2, Introduction to Python Modules, discusses the meaning of a module, how to import a module, show all functions contained in an imported module, adopt a short name for an imported module, compare between import math and from math import, delete an imported module, import just a few functions from a module, introduction to NumPy, SciPy, matplotlib, statsmodels, pandas and Pandas_reader, find out all built-in modules and all available (preinstalled) modules, how to find a specific uninstalled module.
Chapter 3, Time Value of Money, introduces and discusses various basic concepts and formulae associated with finance, such as present value of one future cash flow, present value of (growing) perpetuity, present and future value of annuity, perpetuity vs. perpetuity due, annuity vs. annuity due, relevant functions contained in SciPy and numpy.lib.financial submodule, a free financial calculator, written in Python, definition of NPV (Net Present Value) and its related rule, definition of IRR (Internal Rate of Return) and its related rule, Python graphical presentation of time value of money, and NPV profile.
Chapter 4, Sources of Data, discusses how to retrieve data from various public sources, such as Yahoo!Finance, Google finance, FRED (Federal Reserve Bank's Economics Data Library), Prof. French's Data Library, BLS (Bureau of Labor Statistics) and Census Bureau. In addition, it would discuss various methods to input data, such as files with formats of csv, txt, pkl, Matlab, SAS or Excel.
Chapter 5, Bond and Stock Valuation, introduces interest rate and its related concepts, such as APR (Annual Percentage Rate), EAR (Effective Annual Rate), compounding frequency, how to convert one effective rate to another one, the term structure of interest rate, how to estimate the selling price of a regular bond, how to use the so-called discount dividend model to estimate the price of a stock and so on.
Chapter 6, Capital Asset Pricing Model, shows how to download data from Yahoo!Finance in order to run a linear regression for CAPM, rolling beta, several Python programs to estimate beta for multiple stocks, adjusted beta and portfolio beat estimation, two beta adjustment methods by Scholes and Williams (1977) Dimson (1979).
Chapter 7, Multifactor Models and Performance Measures, shows how to extend the single-factor model, described in Chapter 6, Capital Asset Pricing Model, to multifactor and complex models such as the Fama-French three-factor model, the Fama-French-Carhart four-factor model, and the Fama-French five-factor model, and performance measures such as the Sharpe ratio, Treynor ratios, Sortino ratio, and Jensen's alpha.
Chapter 8, Time-Series Analysis, shows how to design a good date variable, merge datasets by this date variable, normal distribution, normality tests, term structure of interest rate, 52-week high and low trading strategy, return estimation, convert daily returns to monthly or annual returns, T-test, F-test, Durbin-Watson test for autocorrelation, Fama-MacBeth regression, Roll (1984) spread, Amihud's (2002) illiquidity, Pastor and Stambaugh's (2003) liquidity measure, January effect, weekday effect, retrieving high-frequency data from Google Finance and from Prof. Hasbrouck's TORQ database (Trade, Order, Report and Quotation) and introduction to CRSP (Center for Research in Security Prices) database.
Chapter 9, Portfolio Theory, discusses mean and risk estimation of a 2-stock portfolio, N-stock portfolio, correlation vs. diversification effect, how to generate a return matrix, generating an optimal portfolio based on the Sharpe ratio, the Treynor ratio and the Sortinor ratio; how to construct an efficient frontier; Modigliani and Modigliani performance measure (M2 measure); and how to estimate portfolio returns using value-weighted and equal-weighed methodologies.
Chapter 10, Options and Futures, discusses payoff and profit/loss functions for calls and puts and their graphical representations, European versus American options; normal distribution; standard normal distribution; cumulative normal distribution; the famous Black-Scholes-Merton option model with/without dividend; various trading strategies and their visual presentations, such as covered call, straddle, butterfly, and calendar spread; Greeks; the put-call parity and its graphical representation; a graphical representation of a one-step and a two-step binomial tree model; how to use the binomial tree method to price both European and American options; and implied volatility, volatility smile, and skewness.
Chapter 11, Value at Risk, first reviews the density and cumulative functions of a normal distribution, then discusses the first method to estimate VaR based on the normality assumption, conversion from one day risk to n-day risk, one-day VaR to n-day VaR, normality tests, impact of skewness and kurtosis, modifying the VaR measure by including both skewness and kurtosis, the second method to estimate VaR based on historical returns, how to link two methods by using Monte Carlo simulation, back testing, and stress testing.
Chapter 12, Monte Carlo Simulation, discusses how to estimate the π value by using Monte Carlo simulation; simulating stock price movement with a lognormal distribution; constructing efficient portfolios and an efficient frontier; replicating the Black-Scholes-Merton option model by simulation; pricing several exotic options, such as lookback options with floating strikes; bootstrapping with/without replacements; long term expected return forecast and a related efficiency, quasi Monte Carlo simulation, and Sobol sequence.
Chapter 13, Credit Risk Analysis, discusses Moody's, Standard & Poor's, and Fitch's credit ratings, credit spread, 1-year and 5-year migration matrices, term structure of interest rate, Altman's Z-score to predict corporate bankruptcy, the KMV model to estimate total assets and its volatility, default probability and distance to default, and credit default swap.
Chapter 14, Exotic Options, first compares European and American options we learned about in Chapter 9, Portfolio Theory with Bermudan options, then discusses methods to price simple chooser options; shout, rainbow, and binary options; the average price option; barrier options such as the up-and-in option and the up-and-out option; and barrier options such as down-and-in and down-and-out options.
Chapter 15, Volatility, Implied Volatility, ARCH, and GARCH, focuses on two issues: volatility measures and ARCH/GARCH.