Python for finance: apply powerful finance models and quantitative analysis with python
- 2nd.
- Mumbai: Packt Publishing Limited, 2017.
- xvii., 558 p. ref., ind. 24 cm x 18 cm
Chapter 1: Python Basics Python installation Variable assignment, empty space, and writing our own programs Writing a Python function Python loops Data input Data manipulation Data output Exercises Summary
Chapter 2: Introduction to Python Modules What is a Python module? Introduction to NumPy Introduction to SciPy Introduction to matplotlib Introduction to statsmodels Introduction to pandas Python modules related to finance Introduction to the pandas_reader module Two financial calculators How to install a Python module Module dependency Exercises Summary
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 Exercises Summary Chapter 4: Sources of Data Diving into deeper concepts Summary
Chapter 5: Bond and Stock Valuation Introduction to interest rates Term structure of interest rates Bond evaluation Stock valuation A new data type – dictionary Summary
Chapter 6: Capital Asset Pricing Model Introduction to CAPM Moving beta Adjusted beta Extracting output data Simple string manipulation Python via Canopy References Exercises Summary
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 Performance measures How to merge different datasets References Exercises Summary
Chapter 8: Time-Series Analysis Introduction to time-series analysis Merging datasets based on a date variable Understanding the interpolation technique Tests of normality 52-week high and low trading strategy Estimating Roll's spread Estimating Amihud's illiquidity Estimating Pastor and Stambaugh (2003) liquidity measure Fama-MacBeth regression Durbin-Watson Python for high-frequency data Spread estimated based on high-frequency data Introduction to CRSP References Exercises Summary
Chapter 9: Portfolio Theory Introduction to portfolio theory A 2-stock portfolio Optimization – minimization Forming an n-stock portfolio Constructing an optimal portfolio Constructing an efficient frontier with n stocks References Exercises Summary
Chapter 10: Options and Futures Introducing futures Payoff and profit/loss functions for call and put options European versus American options Black-Scholes-Merton option model on non-dividend paying stocks Generating our own module p4f European options with known dividends Various trading strategies Put-call parity and its graphic presentation Binomial tree and its graphic presentation Hedging strategies Implied volatility Binary-search Retrieving option data from Yahoo! Finance Volatility smile and skewness References Exercises Summary
Chapter 11: Value at Risk Introduction to VaR Normality tests Skewness and kurtosis Modified VaR VaR based on sorted historical returns Simulation and VaR VaR for portfolios Backtesting and stress testing Expected shortfall References Exercises Summary
Chapter 12: Monte Carlo Simulation Importance of Monte Carlo Simulation Generating random numbers from a standard normal distribution Generating random numbers with a seed 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 Liking two methods for VaR using simulation Capital budgeting with Monte Carlo Simulation Python SimPy module 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 References Exercises Summary
Chapter 13: Credit Risk Analysis Introduction to credit risk analysis Credit rating Credit spread 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 Distance to default Credit default swap References Exercises Summary
Chapter 14: Exotic Options European, American, and Bermuda options Chooser options Shout options Binary options Rainbow options Pricing average options Pricing barrier options Barrier in-and-out parity Graph of up-and-out and up-and-in parity Pricing lookback options with floating strikes References Exercises Summary
Chapter 15: Volatility, Implied Volatility, ARCH, and GARCH Conventional volatility measure – standard deviation Tests of normality Estimating fat tails 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 The ARCH model Simulating an ARCH (1) process The GARCH model Simulating a GARCH process Simulating a GARCH (p,q) process using modified garchSim GJR_GARCH by Glosten, Jagannanthan, and Runkle References Exercises Summary