How to Build and Test a Trading Strategy Using ML
How to Build and Test a Trading Strategy Using ML


The rapid progress in machine learning (ML) and the massive increase in data availability has enabled novel approaches to quantitative investment and increased the demand for the application of data science to develop discretionary and automated trading strategies.

This workshop covers popular ML use cases for the investment industry. In particular, it focuses on how ML fits into the workflow of developing a trading strategy, from the engineering of financial features to the development of an ML model that generates tradable signals, the backtesting of a trading strategy that acts on these signals and the evaluation of its performance.

We’ll use common Python data science and ML libraries as well as Zipline, Pyfolio, and Alphalens. The code examples will be presented using jupyter notebooks and are based on the second edition of my book ‘Machine Learning for Algorithmic Trading’.

Session Outline
Part 1: The ML for Trading Workflow
We'll look at the big picture of how ML fits into the development and execution of a trading strategy from data sourcing to portfolio management.

Part 2: How to work with market, fundamental, and alternative data
This part introduces various data sources useful for the design of a trading strategy and shows how to extract features that contain signals predictive of future price movements and evaluate their signal content using Alphalens.

Part 3: How to build and test an ML model to generate trading signals
Now we'll walk through how to design and tune various ML models to predict returns using the features engineered in Part 2.

Part 4: How to design and backtest a trading strategy
Finally, we'll use the model predictions as trading signals and define corresponding rules to enter long and short positions. We'll backtest the strategy using Zipline and evaluate its performance using Pyfolio.

Background Knowledge
We'll use common Python data science libraries like pandas, NumPy, scikit-learn, TensorFlow, as well as the backtesting and financial performance libraries Zipline, Alphalens and Pyfolio.


Stefan is the founder and Lead Data Scientist at Applied AI. He advises Fortune 500 companies, investment firms and startups across industries on data & AI strategy, building data science teams, and developing machine learning solutions. Before his current venture, he was a partner and managing director at an international investment firm where he built the predictive analytics and investment research practice. He also was a senior executive at a global fintech company with operations in 15 markets.
Earlier, he advised Central Banks in emerging markets, worked for the World Bank, raised $35m from the Gates Foundation to cofound the Alliance for Financial Inclusion, and has worked in six languages across Asia, Africa, and Latin America. Stefan holds Master degrees in Computer Science from Georgia Tech and in Economics from Harvard and Free University Berlin and is a CFA Charterholder. He is the author for ‘Machine Learning for Algorithmic Trading’ and has been teaching data science at Datacamp and General Assembly.

Open Data Science

Open Data Science
Innovation Center
101 Main St
Cambridge, MA 02142

Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Consent to display content from Youtube
Consent to display content from Vimeo
Google Maps
Consent to display content from Google