This is the code repository for Hands-On Financial Trading with Python, published by Packt.
A practical guide to using Zipline and other Python libraries for backtesting trading strategies
Algorithmic trading helps you stay ahead of the markets by devising strategies in quantitative analysis to gain profits and cut losses.
The book starts by introducing you to algorithmic trading and explaining why Python is the best platform for developing trading strategies. You’ll then cover quantitative analysis using Python, and learn how to build algorithmic trading strategies with Zipline using various market data sources. Using Zipline as the backtesting library allows access to complimentary US historical daily market data until 2018. As you advance, you will gain an in-depth understanding of Python libraries such as NumPy and pandas for analyzing financial datasets, and explore Matplotlib, statsmodels, and scikit-learn libraries for advanced analytics. You’ll also focus on time series forecasting, covering pmdarima and Facebook Prophet.
By the end of this trading book, you will be able to build predictive trading signals, adopt basic and advanced algorithmic trading strategies, and perform portfolio optimization.
This book covers the following exciting features:
- Discover how quantitative analysis works by covering financial statistics and ARIMA
- Use core Python libraries to perform quantitative research and strategy development using real datasets
- Understand how to access financial and economic data in Python
- Implement effective data visualization with Matplotlib
- Apply scientific computing and data visualization with popular Python libraries
- Build and deploy backtesting algorithmic trading strategies
If you feel this book is for you, get your copy today!
All of the code is organized into folders.
The code will look like the following:
fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, figsize=(12, 12), sharex=True)
x = np.linspace(0, 10, num=20)
y1 = np.exp(x)
y2 = x ** 3
y3 = np.sin(y2)
y4 = np.random.randn(20)
ax1.plot(x, y1, color='black', linestyle='--', linewidth=5, marker='x', markersize=15)
ax2.plot(x, y2, color='green', linestyle='-.', linewidth=2, marker='^', markersize=10, alpha=0.9)
ax3.plot(x, y3, color='red', linestyle=':', marker='*', markersize=15, drawstyle='steps')
ax4.plot(x, y4, color='green', linestyle='-', marker='s', markersize=15)
Following is what you need for this book: This book is for data analysts and financial traders who want to explore how to design algorithmic trading strategies using Python’s core libraries. If you are looking for a practical guide to backtesting algorithmic trading strategies and building your own strategies, then this book is for you. Beginner-level working knowledge of Python programming and statistics will be helpful.
With the following software and hardware list you can run all code files present in the book (Chapter 1-9).
Chapter | Software required | OS required |
---|---|---|
1 - 9 | Anaconda, Python 3.6, JupyterLab | Windows, Mac OS X, and Linux (Any) |
List of packages and dependencies can be found in the environment.yml file |
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.
Jiri Pik is an artificial intelligence architect and strategist who works with major investment banks, hedge funds, and other players. He has architected and delivered breakthrough trading, portfolio, and risk management systems, as well as decision support systems, across numerous industries. His consulting firm, Jiri Pik—RocketEdge, provides its clients with certified expertise, judgment, and execution at lightspeed.
Sourav Ghosh has worked in several proprietary high-frequency algorithmic trading firms over the last decade. He has built and deployed extremely low-latency, highthroughput automated trading systems for trading exchanges around the world, across multiple asset classes. He specializes in statistical arbitrage market-making and pairs trading strategies for the most liquid global futures contracts. He works as a senior quantitative developer at a trading firm in Chicago. He holds a master's in computer science from the University of Southern California. His areas of interest include computer architecture, FinTech, probability theory and stochastic processes, statistical learning and inference methods, and natural language processing