Chapter
Installation of Python via Anaconda
Launching Python via Spyder
Direct installation of Python
Variable assignment, empty space, and writing our own programs
Writing a Python function
Python loops, if...else conditions
Chapter 2: Introduction to
Python Modules
Introduction to matplotlib
How to install matplotlib
Several graphical presentations using matplotlib
Introduction to statsmodels
Python modules related to finance
Introduction to the pandas_reader module
Two financial calculators
How to install a Python module
Chapter 3: Time Value of Money
Introduction to time value of money
Writing a financial calculator in Python
Definition of NPV and NPV rule
Definition of IRR and IRR rule
Definition of payback period and payback period rule
Writing your own financial calculator in Python
Two general formulae for many functions
Appendix A – Installation of Python, NumPy, and SciPy
Appendix B – visual presentation of time value of money
Appendix C – Derivation of present value of annuity from present value of one future cash flow and present value of perpetuity
Appendix D – How to download a free financial calculator written in Python
Appendix E – The graphical presentation of the relationship between NPV and R
Appendix F – graphical presentation of NPV profile with two IRRs
Appendix G – Writing your own financial calculator in Python
Chapter 4: Sources of Data
Diving into deeper concepts
Retrieving data from Yahoo!Finance
Retrieving data from Google Finance
Retrieving data from FRED
Retrieving data from Prof. French's
data library
Retrieving data from the Census Bureau, Treasury, and BLS
Generating two dozen datasets
Several datasets related to CRSP and Compustat
Appendix A – Python program for return distribution versus a normal distribution
Appendix B – Python program to a draw
candle-stick picture
Appendix C – Python program for price movement
Appendix D – Python program to show a picture of a stock's intra-day movement
Appendix E –properties for a pandas DataFrame
Appendix F –how to generate a Python dataset with an extension of .pkl or .pickle
Appendix G – data case #1 -generating several Python datasets
Chapter 5: Bond and Stock Valuation
Introduction to interest rates
Term structure of interest rates
A new data type – dictionary
Appendix A – simple interest rate versus compounding interest rate
Appendix B – several Python functions related to interest conversion
Appendix C – Python program for rateYan.py
Appendix D – Python program to estimate stock price based on an n-period model
Appendix E – Python program to estimate the duration for a bond
Appendix F – data case #2 – fund raised from a new bond issue
Chapter 6: Capital Asset Pricing Model
Scholes and William adjusted beta
Outputting data to text files
Saving our data to a .csv file
Saving our data to an Excel file
Saving our data to a pickle dataset
Saving our data to a binary file
Reading data from a binary file
Simple string manipulation
Chapter 7: Multifactor Models and Performance Measures
Introduction to the Fama-French
three-factor model
Fama-French three-factor model
Fama-French-Carhart four-factor model and Fama-French five-factor model
Implementation of Dimson (1979) adjustment for beta
How to merge different datasets
Appendix A – list of related Python datasets
Appendix B – Python program to generate ffMonthly.pkl
Appendix C – Python program for
Sharpe ratio
Appendix D – data case #4 – which model is the best, CAPM, FF3, FFC4, or FF5, or others?
Chapter 8: Time-Series Analysis
Introduction to time-series analysis
Merging datasets based on a date variable
Using pandas.date_range() to generate one dimensional time-series
Converting daily returns to monthly ones
Understanding the interpolation technique
Merging data with different frequencies
Testing the January effect
52-week high and low trading strategy
Estimating Amihud's illiquidity
Estimating Pastor and Stambaugh (2003) liquidity measure
Python for high-frequency data
Spread estimated based on
high-frequency data
Appendix A – Python program to generate GDP dataset usGDPquarterly2.pkl
Appendix B – critical values of F for the 0.05 significance level
Appendix C – data case #4 - which political party manages the economy better?
Chapter 9: Portfolio Theory
Introduction to portfolio theory
Optimization – minimization
Forming an n-stock portfolio
Constructing an optimal portfolio
Constructing an efficient frontier with n stocks
Appendix A – data case #5 - which industry portfolio do you prefer?
Appendix B – data case #6 - replicate S&P500 monthly returns
Chapter 10: Options and Futures
Payoff and profit/loss functions for call and put options
European versus American options
Understanding cash flows, types of options, rights and obligations
Black-Scholes-Merton option model on non-dividend paying stocks
Generating our own module p4f
European options with known dividends
Various trading strategies
Covered-call – long a stock and short a call
Straddle – buy a call and a put with the same exercise prices
The relationship between input values and
option values
Put-call parity and its graphic presentation
The put-call ratio for a short period with
a trend
Binomial tree and its graphic presentation
Binomial tree (CRR) method for European options
Binomial tree (CRR) method for American options
Retrieving option data from Yahoo! Finance
Volatility smile and skewness
Appendix A – data case 6: portfolio insurance
Chapter 11: Value at Risk
VaR based on sorted historical returns
Backtesting and stress testing
Appendix A – data case 7 – VaR estimation for individual stocks and a portfolio
Chapter 12: Monte Carlo Simulation
Importance of Monte Carlo Simulation
Generating random numbers from a standard normal distribution
Drawing random samples from a normal distribution
Generating random numbers with a seed
Random numbers from a normal distribution
Histogram for a normal distribution
Graphical presentation of a lognormal distribution
Generating random numbers from a uniform distribution
Using simulation to estimate the pi value
Generating random numbers from a Poisson distribution
Selecting m stocks randomly from n given stocks
With/without replacements
Distribution of annual returns
Simulation of stock price movements
Graphical presentation of stock prices at options' maturity dates
Replicating a Black-Scholes-Merton call using simulation
Exotic option #1 – using the Monte Carlo Simulation to price average
Exotic option #2 – pricing barrier options using the Monte Carlo Simulation
Liking two methods for VaR using simulation
Capital budgeting with Monte Carlo Simulation
Comparison between two social policies – basic income and basic job
Finding an efficient frontier based on two stocks by using simulation
Constructing an efficient frontier
with n stocks
Long-term return forecasting
Efficiency, Quasi-Monte Carlo, and Sobol sequences
Appendix A – data case #8 - Monte Carlo Simulation and blackjack
Chapter 13: Credit Risk Analysis
Introduction to credit risk analysis
YIELD of AAA-rated bond, Altman Z-score
Using the KMV model to estimate the market value of total assets and its volatility
Term structure of interest rate
Appendix A – data case #8 - predicting bankruptcy by using Z-score
Chapter 14: Exotic Options
European, American, and Bermuda options
Barrier in-and-out parity
Graph of up-and-out and up-and-in parity
Pricing lookback options with floating strikes
Appendix A – data case 7 – hedging crude oil
Chapter 15: Volatility, Implied Volatility, ARCH, and GARCH
Conventional volatility measure – standard deviation
Lower partial standard deviation and Sortino ratio
Test of equivalency of volatility over
two periods
Test of heteroskedasticity, Breusch,
and Pagan
Volatility smile and skewness
Graphical presentation of volatility clustering
Simulating an ARCH (1) process
Simulating a GARCH process
Simulating a GARCH (p,q) process using modified garchSim()
GJR_GARCH by Glosten, Jagannanthan, and Runkle
Appendix A – data case 8 - portfolio hedging using VIX calls
Appendix B – data case 8 - volatility smile and its implications