Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Jason Strimpel

Rating No ratings yet

Transform financial market data into algorithmic trading strategies and deploy them into a live trading environment with recipes leveraging modern Python libraries like pandas, Polars, and DuckDB Key Features Backtest Python trading strategies with VectorBT and Zipline Reloaded using walk-forward analysis Measure risk, performance, and alpha quality with Alphalens Reloaded and PyFolio Automate strategy execution with the Interactive Brokers API for live trading Book DescriptionGet practical Python code for algorithmic trading from Jason Strimpel, founder of PyQuant News and a veteran of global trading, risk management, and machine learning. This hands-on guide shows you how to turn market data into tested, automated trading strategies using modern Python tools. You’ll source equities, options, and futures data with OpenBB and FMP, then accelerate Python for data analysis workflows with Pandas, Polars, Parquet, DuckDB, and ArcticDB. You’ll visualize market data with Matplotlib, Seaborn, and Plotly Dash before moving into alpha research and quantitative trading techniques. Detailed recipes help you engineer alpha factors with PCA, regression, Fama-French models, SciPy, and statsmodels. You’ll design and evaluate quantitative trading strategies using VectorBT, Zipline Reloaded, Alphalens Reloaded, and PyFolio, including walk-forward analysis and risk-aware performance review. For execution, you’ll connect to the Interactive Brokers API to stream ticks, manage orders, retrieve portfolio state, and monitor live trading workflows. By the end, you’ll have reusable Python templates for researching, backtesting, evaluating, and operating algorithmic trading strategies.What you will learn Acquire equities, futures, and options data using OpenBB and FMP Process and analyze time series data efficiently with pandas and Polars Store and query massive datasets with ArcticDB, DuckDB, and Parquet Visualize trading data using Matplotlib, Seaborn, and Plotly Dash Engineer alpha facto

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A recipe-driven field manual for turning raw market data into tested, automated trading strategies in Python—covering the full pipeline from data acquisition through alpha research, backtesting, and live execution. Best for developers and quants who already know some Python and want working templates rather than theory. 【Book Arc】 - **Opening (~0%–15%)**: Sets up the environment and data layer—sourcing equities, futures, and options data via OpenBB and FMP, including the practical challenge of assembling large options chains into DataFrames. - **Early (~15%–35%)**: Builds core data skills: pandas indexing, slicing, and resampling; then scales up with Polars, Parquet, DuckDB, and asynchronous downloads for multi-gigabyte, high-frequency datasets. - **Middle (~35%–55%)**: Visualization and storage—Matplotlib, Seaborn, and Plotly Dash for charts like yield-curve animations and return distributions, plus ArcticDB as a local DataFrame store to avoid repeated downloads. - **Late (~55%–80%)**: Alpha research and strategy evaluation—engineering factors with PCA, regression, and Fama-French models, then backtesting with VectorBT and Zipline Reloaded using walk-forward analysis, and measuring performance and alpha quality with Alphalens Reloaded and PyFolio. - **Ending (~80%–100%)**: Live deployment—connecting to the Interactive Brokers API to stream ticks, manage orders, retrieve portfolio state, and monitor running strategies, ending with reusable templates for the whole research-to-execution cycle. 【Key Takeaways】 - **The book is a pipeline, not a single technique** (Opening): data acquisition → transformation → storage → visualization → alpha research → backtest → live execution, each stage feeding the next. - **Data engineering is treated as the real bottleneck** (Early): options chains can contain thousands of contracts per underlying, and the book shows async, rate-limited downloads (with semaphores and progress bars) to pull tens of thousands of symbols into Parquet. - **pandas is the baseline, Polars is the upgrade** (Early): pandas remains the standard for tabular work, but Polars' lazy execution and expression syntax are positioned for datasets that grow into gigabytes. - **Storage choices matter for iteration speed** (Middle): ArcticDB is presented as a local DataFrame database that eliminates repeated downloads, with Polars reading options data far faster than pandas in the cited comparison. - **Visualization serves risk and correlation judgment** (Middle): joint plots, box plots, and animated yield-curve charts are framed as tools for diversification, pairs trading, and risk management—not decoration. - **Alpha research is factor-driven** (Late): PCA, regression, and Fama-French models are used to engineer and evaluate factors, with Alphalens Reloaded and PyFolio for alpha quality and risk-aware performance review. - **Backtesting must be walk-forward and risk-aware** (Late): VectorBT and Zipline Reloaded are paired with walk-forward analysis so strategies are judged on out-of-sample behavior, not curve-fit results. - **Live trading is an API integration problem** (Ending): the Interactive Brokers API handles tick streaming, order management, and portfolio state, turning a backtest into an operating system. 【Reading Tips】 - **Skim the pandas chapter if you're fluent**—its indexing, resampling, and rolling-window recipes are foundational but familiar; jump to the Polars/DuckDB chapter for the real speed gains. - **Deep-read the async download and storage recipes** (Early–Middle): the concurrency, rate-limiting, and ArcticDB patterns are the hardest to reconstruct on your own and the most reusable. - **Treat backtesting and evaluation as one unit** (Late): read VectorBT/Zipline alongside Alphalens/PyFolio so you internalize walk-forward discipline rather than just running a single backtest. - **Don't skip the live-execution chapter** even if you're research-only—the order and portfolio-state patterns clarify what your backtest must eventually support. - **Run recipes against your own data** where possible; the book's value is in adaptable templates, and the excerpts show code meant to be modified, not memorized. 【Coverage Limits】 This guide is synthesized from stratified excerpts covering the opening through roughly the middle of the book; the later alpha-research, backtesting, and live-execution chapters are described mainly via the book's own front matter and table of contents, so specific recipe details there are not independently verified from the excerpts.
Excerpt 1
re equities, futures, and options data using OpenBB and FMP Process and analyze time series data efficiently with pandas and Polars Store and query massive d...
View in text
Excerpt 2
value at a specific row-column pair. Chapter 2 62 Figure 2.18: Rolling annualized volatility based on a 22-day lookback window Tip Rolling a method in pandas...
View in text
Excerpt 3
ars' lazy execution engine, powerful expression syntax, and columnar memory model make it an efficient choice for working with time series and large tabular...
View in text
Excerpt 4
b = arctic.get_library("options", create_if_missing=True) 3. Read all CSV files from the rut-eod directory and store their data in the Arctic database: lf =...
View in text
Excerpt 5
d_ir}") print(f"Unhedged information ratio: {unhedged_ir}") Running the idx_b76313d8preceding code idx_f2362770block shows us the unhedged portfolio has a lo...
View in text
Excerpt 6
his example, we use SPY: pf.plotting.plot_rolling_returns( returns, factor_returns=benchmark_returns ) The result is a chart with the strategy's equity curve...
View in text
Excerpt 7
ollowing code block under the definitions of the contracts: data = app.get_historical_data( request_id=99, contract=aapl, duration='2 D', bar_size='30 secs'...
View in text
Excerpt 8
d of the distribution of potential losses. The method first retrieves the NetLiquidation value of the account, which represents the total value of the portfo...
View in text
Tags
AI categories
PythonDataBackend
ISBN: 1806662027
Publisher: Packt Publishing
Publish Year: 2026
Language: English
File Format: PDF
File Size: 10.8 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…