Python for Finance Cookbook: Over 80 powerful recipes for effective financial data analysis, 2nd Edition

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Use modern Python libraries such as pandas, NumPy, and scikit-learn and popular machine learning and deep learning methods to solve financial modeling problems Key Features • Explore unique recipes for financial data processing and analysis with Python • Apply classical and machine learning approaches to financial time series analysis • Calculate various technical analysis indicators and backtesting backtest trading strategies Book Description Python is one of the most popular programming languages in the financial industry, with a huge collection of accompanying libraries. In this new edition of the Python for Finance Cookbook, you will explore classical quantitative finance approaches to data modeling, such as GARCH, CAPM, factor models, as well as modern machine learning and deep learning solutions. You will use popular Python libraries that, in a few lines of code, provide the means to quickly process, analyze, and draw conclusions from financial data. In this new edition, more emphasis was put on exploratory data analysis to help you visualize and better understand financial data. While doing so, you will also learn how to use Streamlit to create elegant, interactive web applications to present the results of technical analyses. Using the recipes in this book, you will become proficient in financial data analysis, be it for personal or professional projects. You will also understand which potential issues to expect with such analyses and, more importantly, how to overcome them. What you will learn • Preprocess, analyze, and visualize financial data • Explore time series modeling with statistical (exponential smoothing, ARIMA) and machine learning models • Uncover advanced time series forecasting algorithms such as Meta's Prophet • Use Monte Carlo simulations for derivatives valuation and risk assessment • Explore volatility modeling using univariate and multivariate GARCH models • Investigate various approaches to asset allocation • Learn how to approach ML-projects using an example of default prediction • Explore modern deep learning models such as Google's TabNet, Amazon's DeepAR and NeuralProphet Who this book is for This book is intended for financial analysts, data analysts and scientists, and Python developers with a familiarity with financial concepts. You'll learn how to correctly use advanced approaches for analysis, avoid potential pitfalls and common mistakes, and reach correct conclusions for a broad range of finance problems. Working knowledge of the Python programming language (particularly libraries such as pandas and NumPy) is necessary.

Author(s): Eryk Lewinson
Edition: 2
Publisher: Packt Publishing
Year: 2022

Language: English
Commentary: Publisher's PDF
Pages: 740
City: Birmingham, UK
Tags: Machine Learning; Deep Learning; Python; Data Visualization; Finance; Forecasting; AutoML; SciPy; Trading; Prophet; Capital Asset Pricing Model; Time Series Analysis; Dashboards; Technical Analysis; ARIMA; Intrinio; Asset Allocation; Monte Carlo Simulations; Data Preprocessing; Backtesting; Streamlit

Cover
Copyright
Contributors
Table of Contents
Preface
Chapter 1: Acquiring Financial Data
Getting data from Yahoo Finance
Getting data from Nasdaq Data Link
Getting data from Intrinio
Getting data from Alpha Vantage
Getting data from CoinGecko
Summary
Chapter 2: Data Preprocessing
Converting prices to returns
Adjusting the returns for inflation
Changing the frequency of time series data
Different ways of imputing missing data
Converting currencies
Different ways of aggregating trade data
Summary
Chapter 3: Visualizing Financial Time Series
Basic visualization of time series data
Visualizing seasonal patterns
Creating interactive visualizations
Creating a candlestick chart
Summary
Chapter 4: Exploring Financial Time Series Data
Outlier detection using rolling statistics
Outlier detection with the Hampel filter
Detecting changepoints in time series
Detecting trends in time series
Detecting patterns in a time series using the Hurst exponent
Investigating stylized facts of asset returns
Summary
Chapter 5: Technical Analysis and Building Interactive Dashboards
Calculating the most popular technical indicators
Downloading the technical indicators
Recognizing candlestick patterns
Building an interactive web app for technical analysis using Streamlit
Deploying the technical analysis app
Summary
Chapter 6: Time Series Analysis and Forecasting
Time series decomposition
Testing for stationarity in time series
Correcting for stationarity in time series
Modeling time series with exponential smoothing methods
Modeling time series with ARIMA class models
Finding the best-fitting ARIMA model with auto-ARIMA
Summary
Chapter 7: Machine Learning-Based Approaches to Time Series Forecasting
Validation methods for time series
Feature engineering for time series
Time series forecasting as reduced regression
Forecasting with Meta’s Prophet
AutoML for time series forecasting with PyCaret
Summary
Chapter 8: Multi-Factor Models
Estimating the CAPM
Estimating the Fama-French three-factor model
Estimating the rolling three-factor model on a portfolio of assets
Estimating the four- and five-factor models
Estimating cross-sectional factor models using the Fama-MacBeth regression
Summary
Chapter 9: Modeling Volatility with GARCH Class Models
Modeling stock returns’ volatility with ARCH models
Modeling stock returns’ volatility with GARCH models
Forecasting volatility using GARCH models
Multivariate volatility forecasting with the CCC-GARCH model
Forecasting the conditional covariance matrix using DCC-GARCH
Summary
Chapter 10: Monte Carlo Simulations in Finance
Simulating stock price dynamics using a geometric Brownian motion
Pricing European options using simulations
Pricing American options with Least Squares Monte Carlo
Pricing American options using QuantLib
Pricing barrier options
Estimating Value-at-Risk using Monte Carlo
Summary
Chapter 11: Asset Allocation
Evaluating an equally-weighted portfolio’s performance
Finding the efficient frontier using Monte Carlo simulations
Finding the efficient frontier using optimization with SciPy
Finding the efficient frontier using convex optimization with CVXPY
Finding the optimal portfolio with Hierarchical Risk Parity
Summary
Chapter 12: Backtesting Trading Strategies
Vectorized backtesting with pandas
Event-driven backtesting with backtrader
Backtesting a long/short strategy based on the RSI
Backtesting a buy/sell strategy based on Bollinger bands
Backtesting a moving average crossover strategy using crypto data
Backtesting a mean-variance portfolio optimization
Summary
Chapter 13: Applied Machine Learning: Identifying Credit Default
Loading data and managing data types
Exploratory data analysis
Splitting data into training and test sets
Identifying and dealing with missing values
Encoding categorical variables
Fitting a decision tree classifier
Organizing the project with pipelines
Tuning hyperparameters using grid searches and cross-validation
Summary
Chapter 14: Advanced Concepts for Machine Learning Projects
Exploring ensemble classifiers
Exploring alternative approaches to encoding categorical features
Investigating different approaches to handling imbalanced data
Leveraging the wisdom of the crowds with stacked ensembles
Bayesian hyperparameter optimization
Investigating feature importance
Exploring feature selection techniques
Exploring explainable AI techniques
Summary
Chapter 15: Deep Learning in Finance
Exploring fastai’s Tabular Learner
Exploring Google’s TabNet
Time series forecasting with Amazon’s DeepAR
Time series forecasting with NeuralProphet
Summary
Packtpage
Other Books You May Enjoy
Index