
Python for Finance Cookbook: Over 80 powerful recipes for effective financial data analysis, 2nd Edition
- Length: 740 pages
- Edition: 2
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2022-12-30
- ISBN-10: 1803243198
- ISBN-13: 9781803243191
- Sales Rank: #162827 (See Top 100 Books)
Use modern Python libraries such as pandas, NumPy, and scikit-learn and popular machine learning and deep learning methods to solve financial modeling problems
Purchase of the print or Kindle book includes a free eBook in the PDF format
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.
Preface Who this book is for What this book covers To get the most out of this book Get in touch 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 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 Visualizing Financial Time Series Basic visualization of time series data Visualizing seasonal patterns Creating interactive visualizations Creating a candlestick chart Summary 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 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 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 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 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 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 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 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 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 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 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 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 Other Books You May Enjoy Index
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Python for Finance Cookbook: Over 80 powerful recipes for effective financial data analysis, 2nd Edition
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.