万本电子书0元读

万本电子书0元读

顶部广告

Mastering Python for Finance电子书

售       价:¥

3人正在读 | 0人评论 9.8

作       者:James Ma Weiming

出  版  社:Packt Publishing

出版时间:2019-04-30

字       数:47.6万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
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 sklearn. 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.
目录展开

Dedication

Contributors

About the author

About the reviewers

Packt is searching for authors like you

About Packt

Why subscribe?

Packt.com

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Getting Started with Python

Overview of Financial Analysis with Python

Getting Python

Preparing a virtual environment

Running Jupyter Notebook

The Python Enhancement Proposal

What is a PEP?

The Zen of Python

Introduction to Quandl

Setting up Quandl for your environment

Plotting a time series chart

Retrieving datasets from Quandl

Plotting a price and volume chart

Plotting a candlestick chart

Performing financial analytics on time series data

Plotting returns

Plotting cumulative returns

Plotting a histogram

Plotting volatility

A quantile-quantile plot

Downloading multiple time series data

Displaying the correlation matrix

Plotting correlations

Simple moving averages

Exponential moving averages

Summary

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

Getting Pulp

A maximization example with linear programming

Outcomes of linear programs

Integer programming

A minimization example with integer programming

Integer programming with binary conditions

Solving linear equations using matrices

The LU decomposition

The Cholesky decomposition

The QR decomposition

Solving with other matrix algebra methods

The Jacobi method

The Gauss-Seidel method

Summary

Nonlinearity in Finance

Nonlinearity modeling

Examples of nonlinear models

The implied volatility model

The Markov regime-switching model

The threshold autoregressive model

Smooth transition models

Root-finding algorithms

Incremental search

The bisection method

Newton's method

The secant method

Combing root-finding methods

SciPy implementations in root-finding

Root-finding scalar functions

General nonlinear solvers

Summary

Numerical Methods for Pricing Options

Introduction to options

Binomial trees in option pricing

Pricing European options

Writing the StockOption base class

A class for European options using a binomial tree

A class for American options using a binomial tree

The Cox–Ross–Rubinstein model

A class for the CRR binomial tree option pricing model

Using a Leisen-Reimer tree

A class for the LR binomial tree option pricing model

The Greeks for free

A class for Greeks with the LR binomial tree

Trinomial trees in option pricing

A class for the trinomial tree option pricing model

Lattices in option pricing

Using a binomial lattice

A class for the CRR binomial lattice option pricing model

Using the trinomial lattice

A class for the trinomial lattice option pricing model

Finite differences in option pricing

The explicit method

Writing the finite difference base class

A class for pricing European options using the explicit method of finite differences

The implicit method

A class for pricing European options using the implicit method of finite differences

The Crank-Nicolson method

A class for pricing European options using the Crank-Nicolson method of finite differences

Pricing exotic barrier options

A down-and-out option

A class for pricing down-and-out-options using the Crank-Nicolson method of finite differences

Pricing American options with finite differences

A class for pricing American options using the Crank-Nicolson method of finite differences

Putting it all together – implied volatility modeling

Implied volatilities of the AAPL American put option

Summary

Modeling Interest Rates and Derivatives

Fixed-income securities

Yield curves

Valuing a zero-coupon bond

Spot and zero rates

Bootstrapping a yield curve

An example of bootstrapping the yield curve

Writing the yield curve bootstrapping class

Forward rates

Calculating the yield to maturity

Calculating the price of a bond

Bond duration

Bond convexity

Short–rate modeling

The Vasicek model

The Cox-Ingersoll-Ross model

The Rendleman and Bartter model

The Brennan and Schwartz model

Bond options

Callable bonds

Puttable bonds

Convertible bonds

Preferred stocks

Pricing a callable bond option

Pricing a zero-coupon bond by the Vasicek model

The value of early exercise

Policy iteration by finite differences

Other considerations in callable bond pricing

Summary

Statistical Analysis of Time Series Data

The Dow Jones industrial average and its 30 components

Downloading Dow component datasets from Quandl

About Alpha Vantage

Obtaining an Alpha Vantage API key

Installing the Alpha Vantage Python wrapper

Downloading the DJIA dataset from Alpha Vantage

Applying a kernel PCA

Finding eigenvectors and eigenvalues

Reconstructing the Dow index with PCA

Stationary and non-stationary time series

Stationarity and non-stationarity

Checking for stationarity

Types of non-stationary processes

Types of stationary processes

The Augmented Dickey-Fuller Test

Analyzing a time series with trends

Making a time series stationary

Detrending

Removing trend by differencing

Seasonal decomposing

Drawbacks of ADF testing

Forecasting and predicting a time series

About the Autoregressive Integrated Moving Average

Finding model parameters by grid search

Fitting the SARIMAX model

Predicting and forecasting the SARIMAX model

Summary

A Hands-On Approach

Interactive Financial Analytics with the VIX

Volatility derivatives

STOXX and the Eurex

The EURO STOXX 50 Index

The VSTOXX

The S&P 500 Index

SPX options

The VIX

Financial analytics of the S&P 500 and the VIX

Gathering the data

Performing analytics

The correlation between the SPX and the VIX

Calculating the VIX Index

Importing SPX options data

Parsing 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

Trading platforms with a public API

Choosing a programming language

System functionalities

Building an algorithmic trading platform

Designing a broker interface

Python library requirements

Installing v20

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

Initializing the broker class

Implementing the method for getting prices

Implementing the method for streaming prices

Implementing the method for sending market orders

Implementing the method for fetching positions

Getting the prices

Sending a simple market order

Getting position updates

Building a mean-reverting algorithmic trading system

Designing the mean-reversion algorithm

Implementing the mean-reversion trader class

Adding event listeners

Writing the mean-reversion signal generators

Running our trading system

Building a trend-following trading platform

Designing the trend-following algorithm

Writing the trend-following trader class

Writing the trend-following signal generators

Running the trend-following trading system

VaR for risk management

Summary

Implementing a Backtesting System

Introducing backtesting

Concerns in backtesting

Concept of an event-driven backtesting system

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

K-means clustering

K-nearest neighbors machine learning algorithm

Classification and regression tree analysis

The 2k factorial design

The genetic algorithm

Summary

Machine Learning for Finance

Introduction to machine learning

Uses of machine learning in finance

Algorithmic trading

Portfolio management

Supervisory and regulatory functions

Insurance and loan underwriting

News sentiment analysis

Machine learning beyond finance

Supervised and unsupervised learning

Supervised learning

Unsupervised learning

Classification and regression in supervised machine learning

Overfitting and underfitting models

Feature engineering

Scikit-learn for machine learning

Predicting prices with a single-asset regression model

Linear regression by OLS

Preparing the independent and target variables

Writing the linear regression model

Risk metrics for measuring prediction performance

Mean absolute error as a risk metric

Mean squared error as a risk metric

Explained variance score as a risk metric

R2 as a risk metric

Ridge regression

Other regression models

Lasso regression

Elastic net

Conclusion

Predicting returns with a cross-asset momentum model

Preparing the independent variables

Preparing the target variables

A multi-asset linear regression model

An ensemble of decision trees

Bagging regressor

Gradient tree boosting regression model

Random forests regression

More ensemble models

Predicting trends with classification-based machine learning

Preparing the target variables

Preparing the dataset of multiple assets as input variables

Logistic regression

Risk metrics for measuring classification-based predictions

Confusion matrix

Accuracy score

Precision score

Recall score

F1 score

Support vector classifier

Other types of classifiers

Stochastic gradient descent

Linear discriminant analysis

Quadratic discriminant analysis

KNN classifier

Conclusion on the use of machine learning algorithms

Summary

Deep Learning for Finance

A brief introduction to deep learning

What is deep learning ?

The artificial neuron

Activation function

Loss functions

Optimizers

Network architecture

TensorFlow and other deep learning frameworks

What is a tensor ?

A deep learning price prediction model with TensorFlow

Feature engineering our model

Requirements

Intrinio as our data provider

Compatible Python environment for TensorFlow

The requests library

The TensorFlow library

Downloading the dataset

Scaling and splitting the data

Building an artificial neural network with TensorFlow

Phase 1 – assembling the graph

Phase 2 – training our model

Plotting predicted and actual values

Credit card payment default prediction with Keras

Introduction to Keras

Installing Keras

Obtaining the dataset

Splitting and scaling the data

Designing a deep neural network with five hidden layers using Keras

Measuring the performance of our model

Running risk metrics

Displaying recorded events in Keras history

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部