
Algorithmic Trading with Python
Description
Book Introduction
How to use Python libraries for efficient and powerful algorithmic trading!
Algorithmic trading, once exclusive to institutional investors, is now available to small organizations and individual traders using online platforms.
Python and its robust package ecosystem have become the essential tool of choice for countless traders today.
In this practical book, author Yves Hilfish shows students, academics, and practitioners how to leverage Python in the fascinating field of algorithmic trading.
Algorithmic trading, once exclusive to institutional investors, is now available to small organizations and individual traders using online platforms.
Python and its robust package ecosystem have become the essential tool of choice for countless traders today.
In this practical book, author Yves Hilfish shows students, academics, and practitioners how to leverage Python in the fascinating field of algorithmic trading.
- You can preview some of the book's contents.
Preview
index
Chapter 1: Python and Algorithmic Trading 1
Python for Finance? 1
Algorithmic Trading 8
Python 12 for Algorithmic Trading
Areas to Focus on and Prerequisites 14
Trading Strategy 15
Conclusion 16
References and Other Resources 17
CHAPTER 2 Python Infrastructure 19
Conda 21 as a package manager
Conda 29, which acts as a virtual environment manager
Using Docker Containers 33
Using Cloud Instances 39
Conclusion 47
References and Other Resources 48
CHAPTER 3 Leveraging Financial Data 49
Reading financial data from different sources 50
Working with Open Data Sources 56
Icon Data API 60
Efficient Storage of Financial Data 69
Conclusion 81
References and Other Resources 82
Python script 83
CHAPTER 4 Mastering Vectorized Backtesting 85
Utilizing Vectorization 87
Simple Moving Average-Based Strategy 93
Momentum-Based Strategy 102
Mean Reversion-Based Strategy 110
Data Snooping and Overfitting 114
Conclusion 116
References and Other Resources 116
Python Script 118
CHAPTER 5 Machine Learning Techniques for Predicting Market Movements 125
Linear Regression-Based Market Movement Prediction 126
Machine Learning-Based Market Movement Prediction 140
Deep Learning-Based Market Movement Prediction 154
Conclusion 165
References and Other Resources 166
Python Script 167
CHAPTER 6 Building a Class for Event-Based Backtesting 173
Backtest Base Class 175
Long-only backtest class 181
Long-Short Backtest Class 184
Conclusion 187
References and Other Resources 188
Python Script 188
CHAPTER 7 Using Real-Time Data and Sockets 197
Running a mock tick data server 199
Mock Tick Data Client Connection 202
Real-time signal generation 203
Visualizing Streaming Data with Plotly 206
Conclusion 212
References and Other Resources 213
Python Script 213
CHAPTER 8 CFD Trading with Oanda 217
Account Configuration 221
Oanda API 222
Search past data 224
Streaming Data Operations 230
Place an order at market price 231
Implementing Real-Time Trading Strategies 233
Retrieve account information 238
Conclusion 240
References and Other Resources 241
Python Script 241
CHAPTER 9 FX Trading with FXCM 243
Getting Started 245
Data Search 246
API Operation 251
Conclusion 257
References and Other Resources 258
CHAPTER 10 Automating Transaction Operations 259
Capital Management 260
Machine Learning-Based Trading Strategies 271
Online Algorithm 283
Infrastructure and Deployment 288
Logging and Monitoring 289
Conclusion 296
References and Other Resources 297
Python Script 297
APPENDIX A Python, NumPy, Matplotlib, and Pandas 301
Python Basics 302
NumPy 311
Matt Plotlip 318
Pandas 323
Conclusion 339
References and Other Resources 339
Search 341
Python for Finance? 1
Algorithmic Trading 8
Python 12 for Algorithmic Trading
Areas to Focus on and Prerequisites 14
Trading Strategy 15
Conclusion 16
References and Other Resources 17
CHAPTER 2 Python Infrastructure 19
Conda 21 as a package manager
Conda 29, which acts as a virtual environment manager
Using Docker Containers 33
Using Cloud Instances 39
Conclusion 47
References and Other Resources 48
CHAPTER 3 Leveraging Financial Data 49
Reading financial data from different sources 50
Working with Open Data Sources 56
Icon Data API 60
Efficient Storage of Financial Data 69
Conclusion 81
References and Other Resources 82
Python script 83
CHAPTER 4 Mastering Vectorized Backtesting 85
Utilizing Vectorization 87
Simple Moving Average-Based Strategy 93
Momentum-Based Strategy 102
Mean Reversion-Based Strategy 110
Data Snooping and Overfitting 114
Conclusion 116
References and Other Resources 116
Python Script 118
CHAPTER 5 Machine Learning Techniques for Predicting Market Movements 125
Linear Regression-Based Market Movement Prediction 126
Machine Learning-Based Market Movement Prediction 140
Deep Learning-Based Market Movement Prediction 154
Conclusion 165
References and Other Resources 166
Python Script 167
CHAPTER 6 Building a Class for Event-Based Backtesting 173
Backtest Base Class 175
Long-only backtest class 181
Long-Short Backtest Class 184
Conclusion 187
References and Other Resources 188
Python Script 188
CHAPTER 7 Using Real-Time Data and Sockets 197
Running a mock tick data server 199
Mock Tick Data Client Connection 202
Real-time signal generation 203
Visualizing Streaming Data with Plotly 206
Conclusion 212
References and Other Resources 213
Python Script 213
CHAPTER 8 CFD Trading with Oanda 217
Account Configuration 221
Oanda API 222
Search past data 224
Streaming Data Operations 230
Place an order at market price 231
Implementing Real-Time Trading Strategies 233
Retrieve account information 238
Conclusion 240
References and Other Resources 241
Python Script 241
CHAPTER 9 FX Trading with FXCM 243
Getting Started 245
Data Search 246
API Operation 251
Conclusion 257
References and Other Resources 258
CHAPTER 10 Automating Transaction Operations 259
Capital Management 260
Machine Learning-Based Trading Strategies 271
Online Algorithm 283
Infrastructure and Deployment 288
Logging and Monitoring 289
Conclusion 296
References and Other Resources 297
Python Script 297
APPENDIX A Python, NumPy, Matplotlib, and Pandas 301
Python Basics 302
NumPy 311
Matt Plotlip 318
Pandas 323
Conclusion 339
References and Other Resources 339
Search 341
Detailed image
.jpg)
Into the book
Let's say an algorithmic trader is interested in trading Bitcoin, the cryptocurrency with the largest market capitalization.
It seems likely that his first task will be to find data showing the historical exchange rate of the dollar (USD).
Using Quandl data and Pandas, you can do this in a minute.
Figure 1-1 (omitting some of the parameters needed to shape the figure) shows the resulting figure when the following Python code is run.
Although Pandas doesn't explicitly import it, by default there's a Python wrapper package called Quandl that adds a 100-day simple moving average (SMA) and returns a DataFrame object that we can use to visualize the raw data using the SMA.
--- p.6
Working with the Icon API using Python offers a key advantage: the ability to easily search unstructured data, and then use Python packages to parse and analyze the data for natural language processing (NLP).
This procedure is as simple and straightforward as financial time series data.
The following code searches for news headlines that include Apple Inc. as the company and the word "Macbook" within a fixed time interval (i.e., a range).
News that matches the conditions are displayed, starting with the most recent news and up to five news items.
--- p.67
Financial time series data in a DataFrame object can also be written directly to a relational database such as SQLite3.
Using a relational database can be useful in scenarios where you need to apply the SQL query language to enable more sophisticated analysis.
When it comes to speed and disk usage, relational databases can't compare to other approaches that rely on binary storage formats like HDF5.
--- p.79
In this chapter, we will introduce statistical techniques such as linear regression and machine learning techniques such as logistic regression to predict future price movements based on past returns.
It also shows how to predict stock market movements using neural networks.
Of course, this chapter alone cannot provide a thorough introduction to machine learning, but it can show, from a practitioner's perspective, how to use specific techniques to solve specific price prediction problems.
--- p.125
When it comes to algorithmic trading, a key question is: "How much capital should be allocated to a given algorithmic trading strategy, given total available capital?"
The answer to this question depends on what your primary goal is with algorithmic trading.
Most individuals and financial institutions would agree that maximizing long-term wealth is a good candidate for a goal.
This is what Edward Thorp took into account when he derived the Kelly criterion for investing, as described in Rotando and Thorp (1992).
Simply put, the Kelly Criterion is a criterion that allows traders to explicitly calculate the percentage of available capital they should deploy in their strategies, taking into account statistical return characteristics.
It seems likely that his first task will be to find data showing the historical exchange rate of the dollar (USD).
Using Quandl data and Pandas, you can do this in a minute.
Figure 1-1 (omitting some of the parameters needed to shape the figure) shows the resulting figure when the following Python code is run.
Although Pandas doesn't explicitly import it, by default there's a Python wrapper package called Quandl that adds a 100-day simple moving average (SMA) and returns a DataFrame object that we can use to visualize the raw data using the SMA.
--- p.6
Working with the Icon API using Python offers a key advantage: the ability to easily search unstructured data, and then use Python packages to parse and analyze the data for natural language processing (NLP).
This procedure is as simple and straightforward as financial time series data.
The following code searches for news headlines that include Apple Inc. as the company and the word "Macbook" within a fixed time interval (i.e., a range).
News that matches the conditions are displayed, starting with the most recent news and up to five news items.
--- p.67
Financial time series data in a DataFrame object can also be written directly to a relational database such as SQLite3.
Using a relational database can be useful in scenarios where you need to apply the SQL query language to enable more sophisticated analysis.
When it comes to speed and disk usage, relational databases can't compare to other approaches that rely on binary storage formats like HDF5.
--- p.79
In this chapter, we will introduce statistical techniques such as linear regression and machine learning techniques such as logistic regression to predict future price movements based on past returns.
It also shows how to predict stock market movements using neural networks.
Of course, this chapter alone cannot provide a thorough introduction to machine learning, but it can show, from a practitioner's perspective, how to use specific techniques to solve specific price prediction problems.
--- p.125
When it comes to algorithmic trading, a key question is: "How much capital should be allocated to a given algorithmic trading strategy, given total available capital?"
The answer to this question depends on what your primary goal is with algorithmic trading.
Most individuals and financial institutions would agree that maximizing long-term wealth is a good candidate for a goal.
This is what Edward Thorp took into account when he derived the Kelly criterion for investing, as described in Rotando and Thorp (1992).
Simply put, the Kelly Criterion is a criterion that allows traders to explicitly calculate the percentage of available capital they should deploy in their strategies, taking into account statistical return characteristics.
--- p.260
Publisher's Review
When it comes to the topic of "algorithmic trading using Python," this is the only book that covers it so broadly and deeply!
Algorithmic trading, once exclusive to institutional investors, is now available to small organizations and individual traders using online platforms.
Python and its robust package ecosystem have become the essential tool of choice for countless traders today, and in this practical book, author Yves Hilfish shows students, academics, and practitioners how to leverage Python in the fascinating field of algorithmic trading.
Additionally, this book provides options for systematically building and deploying automated algorithmic trading strategies, which can significantly help you level the playing field on your own.
Main contents of this book
- Setting up a Python environment suitable for algorithmic trading
- Learn how to retrieve financial data from public or private data sources.
- Exploring vectorization methods for financial analysis using NumPy and Pandas.
- Master vectorized backtesting for various algorithmic trading strategies.
Predicting the market using machine learning and deep learning.
- Solving real-time processing problems of streaming data using socket programming tools.
Implement automated algorithmic trading strategies based on trading platforms like Oanda and FXCM.
Target audience for this book
Students, academics, and practitioners with background knowledge in Python programming and financial trading who want to apply Python to the field of algorithmic trading.
Algorithmic trading, once exclusive to institutional investors, is now available to small organizations and individual traders using online platforms.
Python and its robust package ecosystem have become the essential tool of choice for countless traders today, and in this practical book, author Yves Hilfish shows students, academics, and practitioners how to leverage Python in the fascinating field of algorithmic trading.
Additionally, this book provides options for systematically building and deploying automated algorithmic trading strategies, which can significantly help you level the playing field on your own.
Main contents of this book
- Setting up a Python environment suitable for algorithmic trading
- Learn how to retrieve financial data from public or private data sources.
- Exploring vectorization methods for financial analysis using NumPy and Pandas.
- Master vectorized backtesting for various algorithmic trading strategies.
Predicting the market using machine learning and deep learning.
- Solving real-time processing problems of streaming data using socket programming tools.
Implement automated algorithmic trading strategies based on trading platforms like Oanda and FXCM.
Target audience for this book
Students, academics, and practitioners with background knowledge in Python programming and financial trading who want to apply Python to the field of algorithmic trading.
GOODS SPECIFICS
- Publication date: July 29, 2021
- Page count, weight, size: 376 pages | 188*245*30mm
- ISBN13: 9791191600100
- ISBN10: 1191600106
You may also like
카테고리
korean
korean