What this book covers
Chapter 1, Acquire Free Financial Market Data with Cutting-edge Python Libraries, provides an in-depth exploration of acquiring various types of financial market data. You will learn to work with stock market, historic futures, and options market data using the OpenBB Platform, and harness factor data using pandas-datareader.
Chapter 2, Analyze and Transform Financial Market Data with pandas, dives into the powerful pandas library for data manipulation. This chapter explains pandas index types, building series and DataFrames, and transforming data. You will learn to calculate asset returns, measure volatility, generate cumulative returns, resample data, address missing data issues, and apply custom functions to analyze time series data.
Chapter 3, Visualize Financial Market Data with Matplotlib, Seaborn, and Plotly Dash, covers techniques for visualizing financial data. You will quickly visualize data using pandas, animate yield curve evolution with Matplotlib, plot options implied volatility surfaces, visualize statistical relationships with Seaborn, and create an interactive PCA analytics dashboard with Plotly Dash.
Chapter 4, Store Financial Market Data on Your Computer, discusses methods for efficiently storing financial data. You will learn to store data in CSV format, SQLite, a networked Postgres database, and the ultra-fast HDF5 format, ensuring your data is easily accessible and well organized for analysis and backtesting.
Chapter 5, Build Alpha Factors for Stock Portfolios, focuses on creating alpha factors. It covers identifying latent return drivers with principal component analysis, hedging portfolio beta using linear regression, analyzing portfolio sensitivities to Fama-French factors, assessing market inefficiency based on volatility, and preparing a factor ranking model using Zipline pipelines.
Chapter 6, Vector-Based Backtesting with VectorBT, introduces vector-based backtesting. This chapter guides you through experimenting with millions of strategy combinations, conducting walk-forward optimization, and implementing a risk parity backtest using VectorBT, providing a robust framework for strategy evaluation.
Chapter 7, Event-Based Backtesting Factor Portfolios with Zipline Reloaded, explores event-based backtesting. You will backtest a momentum factor strategy and explore a mean reversion strategy using Zipline Reloaded, helping you understand the dynamics and performance of various trading strategies.
Chapter 8, Evaluate Factor Risk and Performance with Alphalens Reloaded, examines factor risk and performance. You will prepare backtest results, evaluate the information coefficient, examine factor return performance, and evaluate factor turnover, ensuring a comprehensive analysis of your trading strategies.
Chapter 9, Assess Backtest Risk and Performance Metrics with Pyfolio, covers risk and performance assessment. This chapter explains preparing Zipline backtest results for pyfolio, generating strategy performance analytics, building a drawdown and rolling risk analysis, analyzing strategy holdings, leverage, exposure, sector allocations, and breaking down performance to the trade level.
Chapter 10, Set Up the Interactive Brokers Python API, provides a guide to building an algorithmic trading app. You will create contract and order objects with the IB API, fetch historical market data, get market data snapshots, stream live tick data, and store live tick data in a local SQL database, enabling real-time trading and data management.
Chapter 11, Manage Orders, Positions, and Portfolios with the IB API, explains managing trades and portfolios. You will learn to execute orders, manage placed orders, get portfolio details, inspect positions, and compute portfolio profit and loss, providing comprehensive tools to manage your trading operations.
Chapter 12, Deploy Strategies to a Live Environment, focuses on live trading strategy deployment. This chapter covers calculating real-time performance and risk indicators, sending orders based on portfolio targets, and deploying monthly factor, options combo, and intraday multi-asset mean reversion strategies, ensuring your strategies are effective and responsive in live markets.
Chapter 13, Advanced Recipes for Market Data and Strategy Management, offers advanced techniques for managing market data and strategies. You will learn to stream real-time options data with ThetaData, use the ArcticDB DataFrame database for tick storage, trigger real-time risk limit alerts, and store trade execution details in a SQL database, enhancing your data management and strategy implementation capabilities.