Book description
Take your financial skills to the next level by mastering cutting-edge mathematical and statistical financial applications
Key Features
- Explore advanced financial models used by the industry and ways of solving them using Python
- Build state-of-the-art infrastructure for modeling, visualization, trading, and more
- Empower your financial applications by applying machine learning and deep learning
Book Description
The second edition of Mastering Python for Finance will guide you through carrying out complex financial calculations practiced in the industry of finance by using next-generation methodologies. You will master the Python ecosystem by leveraging publicly available tools to successfully perform research studies and modeling, and learn to manage risks with the help of advanced examples.
You will start by setting up your Jupyter notebook to implement the tasks throughout the book. You will learn to make efficient and powerful data-driven financial decisions using popular libraries such as TensorFlow, Keras, Numpy, SciPy, and scikit-learn. You will also learn how to build financial applications by mastering concepts such as stocks, options, interest rates and their derivatives, and risk analytics using computational methods. With these foundations, you will learn to apply statistical analysis to time series data, and understand how time series data is useful for implementing an event-driven backtesting system and for working with high-frequency data in building an algorithmic trading platform. Finally, you will explore machine learning and deep learning techniques that are applied in finance.
By the end of this book, you will be able to apply Python to different paradigms in the financial industry and perform efficient data analysis.
What you will learn
- Solve linear and nonlinear models representing various financial problems
- Perform principal component analysis on the DOW index and its components
- Analyze, predict, and forecast stationary and non-stationary time series processes
- Create an event-driven backtesting tool and measure your strategies
- Build a high-frequency algorithmic trading platform with Python
- Replicate the CBOT VIX index with SPX options for studying VIX-based strategies
- Perform regression-based and classification-based machine learning tasks for prediction
- Use TensorFlow and Keras in deep learning neural network architecture
Who this book is for
If you are a financial or data analyst or a software developer in the financial industry who is interested in using advanced Python techniques for quantitative methods in finance, this is the book you need! You will also find this book useful if you want to extend the functionalities of your existing financial applications by using smart machine learning techniques. Prior experience in Python is required.
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- Contributors
- About Packt
- Preface
- Section 1: Getting Started with Python
- Overview of Financial Analysis with Python
- Section 2: Financial Concepts
-
The Importance of Linearity in Finance
- The Capital Asset Pricing Model and the security market line
- The Arbitrage Pricing Theory model
- Multivariate linear regression of factor models
- Linear optimization
- Solving linear equations using matrices
- The LU decomposition
- The Cholesky decomposition
- The QR decomposition
- Solving with other matrix algebra methods
- Summary
- Nonlinearity in Finance
-
Numerical Methods for Pricing Options
- Introduction to options
- Binomial trees in option pricing
- Pricing European options
- Writing the StockOption base class
- The Greeks for free
- Trinomial trees in option pricing
- Lattices in option pricing
- Finite differences in option pricing
- Putting it all together – implied volatility modeling
- Summary
- Modeling Interest Rates and Derivatives
- Statistical Analysis of Time Series Data
- Section 3: A Hands-On Approach
-
Interactive Financial Analytics with the VIX
- Volatility derivatives
- Financial analytics of the S&P 500 and the VIX
-
Calculating the VIX Index
- Importing SPX options data
- Finding near-term and next-term options
- Calculating the required minutes
- Calculating the forward SPX Index level
- Finding the required forward strike prices
- Determining strike price boundaries
- Tabulating contributions by strike prices
- Calculating the volatilities
- Calculating the next-term options
- Calculating the VIX Index
- Calculating multiple VIX indexes
- Comparing the results
- Summary
-
Building an Algorithmic Trading Platform
- Introducing algorithmic trading
-
Building an algorithmic trading platform
- Designing a broker interface
- Python library requirements
- Writing an event-driven broker class
- Storing the price event handler
- Storing the order event handler
- Storing the position event handler
- Declaring an abstract method for getting prices
- Declaring an abstract method for streaming prices
- Declaring an abstract method for sending orders
- Implementing the broker class
- Building a mean-reverting algorithmic trading system
- Building a trend-following trading platform
- VaR for risk management
- Summary
-
Implementing a Backtesting System
- Introducing backtesting
-
Designing and implementing a backtesting system
- Writing a class to store tick data
- Writing a class to store market data
- Writing a class to generate sources of market data
- Writing the order class
- Writing a class to keep track of positions
- Writing an abstract strategy class
- Writing a mean-reverting strategy class
- Binding our modules with a backtesting engine
- Running our backtesting engine
- Multiple runs of the backtest engine
- Improving your backtesting system
-
Ten considerations for a backtesting model
- Resources restricting your model
- Criteria of evaluation of the model
- Estimating the quality of backtest parameters
- Be prepared to face model risk
- Performance of a backtest with in–sample data
- Addressing common pitfalls in backtesting
- Have a common-sense idea of your model
- Understanding the context for the model
- Make sure you have the right data
- Data mine your results
- Discussion of algorithms in backtesting
- Summary
-
Machine Learning for Finance
- Introduction to machine learning
- Predicting prices with a single-asset regression model
- Predicting returns with a cross-asset momentum model
- Predicting trends with classification-based machine learning
- Conclusion on the use of machine learning algorithms
- Summary
-
Deep Learning for Finance
- A brief introduction to deep learning
- A deep learning price prediction model with TensorFlow
- Credit card payment default prediction with Keras
- Summary
- Other Books You May Enjoy
Product information
- Title: Mastering Python for Finance - Second Edition
- Author(s):
- Release date: April 2019
- Publisher(s): Packt Publishing
- ISBN: 9781789346466
You might also like
book
Python for Finance - Second Edition
Learn and implement various Quantitative Finance concepts using the popular Python libraries About This Book Understand …
book
Python for Finance, 2nd Edition
The financial industry has recently adopted Python at a tremendous rate, with some of the largest …
book
Mastering Python for Finance
Understand, design, and implement state-of-the-art mathematical and statistical applications used in finance with Python In Detail …
video
Hands-On Python for Finance
The practical guide to using data-driven algorithms in Finance About This Video Use libraries like Numpy, …