You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: 01_machine_learning_for_trading/README.md
+1-3
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,7 @@ Historically, algorithmic trading used to be more narrowly defined as the automa
16
16
17
17
This chapter looks at industry trends that have led to the emergence of ML as a source of competitive advantage in the investment industry. We will also look at where ML fits into the investment process to enable algorithmic trading strategies.
18
18
19
-
More specifically, we will be covering the following topics:
20
-
21
-
#### Table of contents
19
+
## Content
22
20
23
21
1.[The rise of ML in the investment industry](#the-rise-of-ml-in-the-investment-industry)
24
22
*[From electronic to high-frequency trading](#from-electronic-to-high-frequency-trading)
For algorithmic trading, new data sources offer an informational advantage if they provide access to information unavailable from traditional sources, or provide access sooner. Following global trends, the investment industry is rapidly expanding beyond market and fundamental data to alternative sources to reap alpha through an informational edge. Annual spending on data, technological capabilities, and related talent are expected to increase from the current $3 billion by 12.8% annually through 2020.
@@ -27,7 +40,18 @@ Today, investors can access macro or company-specific data in real-time that his
27
40
-[Big data: The next frontier for innovation, competition, and productivity](https://www.mckinsey.com/business-functions/digital-mckinsey/our-insights/big-data-the-next-frontier-for-innovation), McKinsey 2011
28
41
-[McKinsey on Artificial Intelligence](https://www.mckinsey.com/featured-insights/artificial-intelligence)
29
42
30
-
## Evaluating Alternative Datasets
43
+
## Sources of alternative data
44
+
45
+
Alternative datasets are generated by many sources but can be classified at a high level as predominantly produced by:
46
+
- Individuals who post on social media, review products, or use search engines
47
+
- Businesses that record commercial transactions, in particular, credit card payments, or capture supply-chain activity as intermediaries
48
+
- Sensors that, among many other things, capture economic activity through images such as satellites or security cameras, or through movement patterns such as cell phone towers
49
+
50
+
The nature of alternative data continues to evolve rapidly as new data sources become available and sources previously labeled “alternative” become part of the mainstream. The Baltic Dry Index (BDI), for instance, assembles data from several hundred shipping companies to approximate the supply/demand of dry bulk carriers and is now available on the Bloomberg Terminal.
51
+
52
+
Alternative data sources differ in crucial respects that determine their value or signal content for algorithmic trading strategies.
53
+
54
+
## Criteria for evaluating alternative datasets
31
55
32
56
The ultimate objective of alternative data is to provide an informational advantage in the competitive search for trading signals that produce alpha, namely positive, uncorrelated investment returns. In practice, the signals extracted from alternative datasets can be used on a standalone basis or combined with other signals as part of a quantitative strategy.
33
57
@@ -48,17 +72,17 @@ This section illustrates the acquisition of alternative data using web scraping,
48
72
-[Quantifying Trading Behavior in Financial Markets Using Google Trends](https://www.nature.com/articles/srep01684), Preis, Moat and Stanley, Nature, 2013
49
73
-[Quantifying StockTwits semantic terms’ trading behavior in financial markets: An effective application of decision tree algorithms](https://www.sciencedirect.com/science/article/pii/S0957417415005473), Al Nasseri et al, Expert Systems with Applications, 2015
50
74
51
-
####Open Table Web Scraping
75
+
###Code Example: Open Table Web Scraping
52
76
53
77
This subfolder [01_opentable](01_opentable) contains the script [opentable_selenium](01_opentable/opentable_selenium.py) to scrape OpenTable data using Scrapy and Selenium.
54
78
55
79
-[How to View the Source Code of a Web Page in Every Browser](https://www.lifewire.com/view-web-source-code-4151702)
The subfolder [02_earnings_calls](02_earnings_calls) contains the script [sa_selenium](02_earnings_calls/sa_selenium.py) to scrape earnings call transcripts from the [SeekingAlpha](www.seekingalpha.com) website.
Copy file name to clipboardexpand all lines: 04_alpha_factor_research/README.md
+38-31
Original file line number
Diff line number
Diff line change
@@ -17,16 +17,35 @@ In particular, this chapter will address the following topics:
17
17
18
18
Please see the [Appendix - Alpha Factor Library](../24_alpha_factor_library) for additional material on this topic, including numerous code examples that compute a broad range of alpha factors.
19
19
20
+
## Content
21
+
22
+
1.[Alpha Factors in practice: from data to signals](#alpha-factors-in-practice-from-data-to-signals)
23
+
2.[Building on Decades of Factor Research](#building-on-decades-of-factor-research)
24
+
*[References](#references)
25
+
3.[Engineering alpha factors that predict returns](#engineering-alpha-factors-that-predict-returns)
26
+
*[Code Example: How to engineer factors using pandas and NumPy](#code-example-how-to-engineer-factors-using-pandas-and-numpy)
27
+
*[Code Example: How to use TA-Lib to create technical alpha factors](#code-example-how-to-use-ta-lib-to-create-technical-alpha-factors)
28
+
*[Code Example: How to denoise your Alpha Factors with the Kalman Filter](#code-example-how-to-denoise-your-alpha-factors-with-the-kalman-filter)
29
+
*[Code Example: How to preprocess your noisy signals using Wavelets](#code-example-how-to-preprocess-your-noisy-signals-using-wavelets)
30
+
*[Resources](#resources)
31
+
4.[From signals to trades: backtesting with `Zipline`](#from-signals-to-trades-backtesting-with-zipline)
32
+
*[Code Example: How to use Zipline to backtest a single-factor strategy](#code-example-how-to-use-zipline-to-backtest-a-single-factor-strategy)
33
+
*[Code Example: Combining factors from diverse data sources on the Quantopian platform](#code-example-combining-factors-from-diverse-data-sources-on-the-quantopian-platform)
34
+
*[Code Example: Separating signal and noise – how to use alphalens](#code-example-separating-signal-and-noise--how-to-use-alphalens)
35
+
5.[Alternative Algorithmic Trading Libraries and Platforms](#alternative-algorithmic-trading-libraries-and-platforms)
36
+
20
37
## Alpha Factors in practice: from data to signals
21
38
22
39
Alpha factors are transformations of market, fundamental, and alternative data that contain predictive signals. They are designed to capture risks that drive asset returns. One set of factors describes fundamental, economy-wide variables such as growth, inflation, volatility, productivity, and demographic risk. Another set consists of tradeable investment styles such as the market portfolio, value-growth investing, and momentum investing.
23
40
24
41
There are also factors that explain price movements based on the economics or institutional setting of financial markets, or investor behavior, including known biases of this behavior. The economic theory behind factors can be rational, where the factors have high returns over the long run to compensate for their low returns during bad times, or behavioral, where factor risk premiums result from the possibly biased, or not entirely rational behavior of agents that is not arbitraged away.
25
42
26
-
### On the shoulders of giants: meet the factor establishment
43
+
##Building on Decades of Factor Research
27
44
28
45
In an idealized world, categories of risk factors should be independent of each other (orthogonal), yield positive risk premia, and form a complete set that spans all dimensions of risk and explains the systematic risks for assets in a given class. In practice, these requirements will hold only approximately.
29
46
47
+
### References
48
+
30
49
-[Dissecting Anomalies](http://schwert.ssb.rochester.edu/f532/ff_JF08.pdf) by Eugene Fama and Ken French (2008)
31
50
-[Explaining Stock Returns: A Literature Review](https://www.ifa.com/pdfs/explainingstockreturns.pdf) by James L. Davis (2001)
32
51
-[Market Efficiency, Long-Term Returns, and Behavioral Finance](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=15108) by Eugene Fama (1997)
@@ -43,18 +62,6 @@ Based on a conceptual understanding of key factor categories, their rationale an
43
62
44
63
The notebook [feature_engineering.ipynb](00_data/feature_engineering.ipynb) in the [data](00_data) directory illustrates how to engineer basic factors.
45
64
46
-
#### Additional Resources
47
-
48
-
-[Fama French](https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html) Data Library
-[10 minutes to pandas](https://pandas.pydata.org/pandas-docs/stable/getting_started/10min.html)
54
-
-[Python Pandas Tutorial: A Complete Introduction for Beginners](https://www.learndatasci.com/tutorials/python-pandas-tutorial-complete-introduction-for-beginners/)
55
-
-[alphatools](https://github.com/marketneutral/alphatools) - Quantitative finance research tools in Python
56
-
-[mlfinlab](https://github.com/hudson-and-thames/mlfinlab) - Package based on the work of Dr Marcos Lopez de Prado regarding his research with respect to Advances in Financial Machine Learning
57
-
58
65
### Code Example: How to use TA-Lib to create technical alpha factors
59
66
60
67
The notebook [how_to_use_talib](02_how_to_use_talib.ipynb) illustrates the usage of TA-Lib, which includes a broad range of common technical indicators. These indicators have in common that they only use market data, i.e., price and volume information.
@@ -65,41 +72,40 @@ The notebook [common_alpha_factors](../24_alpha_factor_library/02_common_alpha_f
65
72
66
73
The notebook [kalman_filter_and_wavelets](03_kalman_filter_and_wavelets.ipynb) demonstrates the use of the Kalman filter using the `PyKalman` package for smoothing; we will also use it in [Chapter 9](../09_time_series_models) when we develop a pairs trading strategy.
-[Tutorial: The Kalman Filter](http://web.mit.edu/kirtley/kirtley/binlustuff/literature/control/Kalman%20filter.pdf)
72
-
-[Understanding and Applying Kalman Filtering](http://biorobotics.ri.cmu.edu/papers/sbp_papers/integrated3/kleeman_kalman_basics.pdf)
73
-
-[How a Kalman filter works, in pictures](https://www.bzarg.com/p/how-a-kalman-filter-works-in-pictures/)
74
-
75
75
### Code Example: How to preprocess your noisy signals using Wavelets
76
76
77
77
The notebook [kalman_filter_and_wavelets](03_kalman_filter_and_wavelets.ipynb) also demonstrates how to work with wavelets using the `PyWavelets` package.
78
78
79
-
#### Additional Resources
79
+
###Resources
80
80
81
+
-[Fama French](https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html) Data Library
-[10 minutes to pandas](https://pandas.pydata.org/pandas-docs/stable/getting_started/10min.html)
87
+
-[Python Pandas Tutorial: A Complete Introduction for Beginners](https://www.learndatasci.com/tutorials/python-pandas-tutorial-complete-introduction-for-beginners/)
88
+
-[alphatools](https://github.com/marketneutral/alphatools) - Quantitative finance research tools in Python
89
+
-[mlfinlab](https://github.com/hudson-and-thames/mlfinlab) - Package based on the work of Dr Marcos Lopez de Prado regarding his research with respect to Advances in Financial Machine Learning
-[Wavelets for Kids](http://www.gtwavelet.bme.gatech.edu/wp/kidsA.pdf)
85
-
86
-
### References
87
-
88
98
-[The Barra Equity Risk Model Handbook](https://www.alacra.com/alacra/help/barra_handbook_GEM.pdf)
89
99
-[Active Portfolio Management: A Quantitative Approach for Producing Superior Returns and Controlling Risk](https://www.amazon.com/Active-Portfolio-Management-Quantitative-Controlling/dp/0070248826) by Richard Grinold and Ronald Kahn, 1999
90
100
-[Modern Investment Management: An Equilibrium Approach](https://www.amazon.com/Modern-Investment-Management-Equilibrium-Approach/dp/0471124109) by Bob Litterman, 2003
91
101
-[Quantitative Equity Portfolio Management: Modern Techniques and Applications](https://www.crcpress.com/Quantitative-Equity-Portfolio-Management-Modern-Techniques-and-Applications/Qian-Hua-Sorensen/p/book/9781584885580) by Edward Qian, Ronald Hua, and Eric Sorensen
## From signals to trades: backtesting with `zipline`
104
+
## From signals to trades: backtesting with `Zipline`
95
105
96
106
The open source [zipline](http://www.zipline.io/index.html) library is an event-driven backtesting system maintained and used in production by the crowd-sourced quantitative investment fund [Quantopian](https://www.quantopian.com/) to facilitate algorithm-development and live-trading. It automates the algorithm's reaction to trade events and provides it with current and historical point-in-time data that avoids look-ahead bias.
97
107
98
-
[Chapter 8](../08_ml4t_workflow) contains a more comprehensive introduction to Zipline.
99
-
100
-
### Installation
101
-
- The current release 1.3 has a few shortcomings such as the [dependency on benchmark data from the IEX exchange](https://github.com/quantopian/zipline/issues/2480) and limitations for importing features beyond the basic OHLCV data points.
102
-
- To enable the use of `zipline`, I've provided a [patched version](https://github.com/stefan-jansen/zipline) that works for the purposes of this book.
108
+
-[Chapter 8](../08_ml4t_workflow) contains a more comprehensive introduction to Zipline.
103
109
- Please follow the [instructions](../installation) in the `installation` folder.
104
110
105
111
### Code Example: How to use Zipline to backtest a single-factor strategy
@@ -127,10 +133,11 @@ The analysis can be conducted using `tearsheets` or individual computations and
127
133
128
134
- See [here](https://github.com/quantopian/alphalens/blob/master/alphalens/examples/alphalens_tutorial_on_quantopian.ipynb) for a detailed `alphalens` tutorial by Quantopian
129
135
130
-
###Alternative Algorithmic Trading Libraries
136
+
## Alternative Algorithmic Trading Libraries and Platforms
0 commit comments