Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Python for Algorithmic Trading Cookbook
  • Toc
  • feedback
Python for Algorithmic Trading Cookbook

Python for Algorithmic Trading Cookbook

By : Jason Strimpel
4.2 (19)
close
Python for Algorithmic Trading Cookbook

Python for Algorithmic Trading Cookbook

4.2 (19)
By: Jason Strimpel

Overview of this book

Discover how Python has made algorithmic trading accessible to non-professionals with unparalleled expertise and practical insights from Jason Strimpel, founder of PyQuant News and a seasoned professional with global experience in trading and risk management. This book guides you through from the basics of quantitative finance and data acquisition to advanced stages of backtesting and live trading. Detailed recipes will help you leverage the cutting-edge OpenBB SDK to gather freely available data for stocks, options, and futures, and build your own research environment using lightning-fast storage techniques like SQLite, HDF5, and ArcticDB. This book shows you how to use SciPy and statsmodels to identify alpha factors and hedge risk, and construct momentum and mean-reversion factors. You’ll optimize strategy parameters with walk-forward optimization using VectorBT and construct a production-ready backtest using Zipline Reloaded. Implementing all that you’ve learned, you’ll set up and deploy your algorithmic trading strategies in a live trading environment using the Interactive Brokers API, allowing you to stream tick-level data, submit orders, and retrieve portfolio details. By the end of this algorithmic trading book, you'll not only have grasped the essential concepts but also the practical skills needed to implement and execute sophisticated trading strategies using Python.
Table of Contents (16 chapters)
close

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.

bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete