Methodology of Quantitative Research: A Brief Summary
The process behind quantitative research for algorithmic trading.
In this part of my newsletter, I will examine the important role of methodology in investment strategies and quantitative research. Methodology holds significant importance in our work as it ensures careful and error-free execution, ultimately mitigating the risk of financial losses. We will explore why diligent and robust methodology plays a crucial role in every investment strategy and quantitative research. Its primary purpose is to eliminate errors throughout the research process, guaranteeing reliable results and accurate conclusions. By employing a sound methodology, we minimize the risk of financial losses and maximize the potential for optimal performance in our final products.
Literature
To begin, I would like to highlight several books and posts that provide insightful information. As this series progresses, I will continue expanding the literature section, sharing new findings with you. One notable resource that partly inspired this summary, is a post by Peter Kostovcik on algo trading approaches, which you can find here. Additionally, the following books are recommended for further study:
"Learn Algorithmic Trading" by S. Donadio
"Machine Learning for Algorithmic Trading" by S. Jansen
"Python for Algorithmic Trading: From Idea to Cloud Deployment" by Y. Hilpisch
For a more scientific approach, consider titles such as:
"Quantitative Trading: How to Build Your Own Algorithmic Trading Business" by E. Chan
"Quantitative Equity Investing: Techniques and Strategies" by F. Fabozzi
I also highly recommend familiarizing yourself with "Analysis of Financial Time Series" by R. Tsay and "The Econometrics of Financial Markets" by J. Campbell, as they provide fundamental knowledge of the methodology employed in our work.
Data Acquisition
The first step in our methodology involves acquiring the necessary data for research purposes. Various data sources, both free and paid, offer a wide range of information. Popular free sources include Yahoo Finance, Stooq, and AlphaVantage. However, specific research requirements, such as futures contracts or high-frequency data, may require the use of paid sources like Interactive Brokers, Quandl, or Bloomberg. It is also a good idea to maintain a curated list of reliable data sources, as they often change over time. In an upcoming post, I will share such a list with you.
Another aspect of data acquisition is feature selection. It involves carefully choosing input variables for the model, as it significantly impacts strategy performance. This process also requires careful planning and testing. Additionally, thorough analysis of data for missing values, outliers, and consistency is a critical aspect of our methodology. Before loading the data, it is essential to clean and prepare it to ensure reliable and accurate results.
Strategy Research
The exploration of existing trading strategies described in books, articles, and papers serves as a valuable learning resource. While published strategies may not be directly suitable for live trading due to the risk of losing a competitive advantage, they aid in understanding the construction and underlying processes of successful strategies. It is also a good idea to maintain a spreadsheet summarizing strategies with associated links to papers or books.
Model Research
Many strategies rely on econometric, statistical, or machine learning models with solid mathematical foundations. Exploring new or less commonly used models, modifying existing ones, or developing new models can provide a competitive edge. Model research, which may itself be a specialization within quantitative research, often takes a more theoretical approach based on those foundations.
Parameters Tuning
Optimizing the performance of the selected model with respect to the chosen strategy is a critical aspect of model research. This step involves tuning parameters for neural networks, selecting appropriate loss functions, and input features. In econometric models, it requires selecting model subclass, parameters or determining the length of the training window. While some of these aspects can be automated, manual work is often required due to the numerous variables and parameters involved.
Implementation
Implementing research, strategies, and models is a key focus of this newsletter. We will be focusing on Python and R, which are widely used in this field, and I will provide code samples primarily in these languages. Additionally, we will discuss relevant libraries and tools that facilitate solving specific problems. Code maintenance and reproducibility will also be addressed.
Strategy Backtesting
Proper backtesting is essential for evaluating our strategies and models. One effective technique commonly used for machine learning models is the walk-forward rolling window approach. Additionally, backtesting strategies can include methodologies such as Monte Carlo simulation and Bootstrap sampling. It is also important to analyze the results obtained during backtesting, considering performance metrics such as the Sharpe ratio, maximum drawdown, and annualized returns. In upcoming articles, we will delve deeper into these various backtesting methodologies.
Costs and Slippage
Transitioning from backtesting to live trading requires accurate cost calculation. Transactional costs and slippage must be considered when assessing strategy performance. While the exact costs are often unknown at this point, using realistic estimations aids in evaluating the strategy's viability and profitability.
Evaluation
Evaluating the tools created requires testing against unseen test data, distinct from what we used for training and tuning. Comparing the model's performance on new data against benchmark strategies, such as buy and hold, random strategies, or simple contrarian and momentum models, is essential for gaining insights into its effectiveness.
Sensitivity Analysis and Robustness
Conducting sensitivity and robustness analysis is important for understanding model behavior. Assessing the model's sensitivity to changes in initial parameter values, especially in neural networks and deep learning models, helps evaluate its robustness. Testing the model's performance across different asset classes ensures its effectiveness across a wide range of market conditions and helps to prevent overfitting.
Risk Management
Evaluating the risk associated with the strategy is a critical aspect of research. Testing against risk metrics, such as Value at Risk, Expected Shortfall, standard deviation, and drawdown indicators, helps understand the strategy's risk profile. Assessing the need for additional funds to handle major drawdown events is essential for risk management.
Paper Trading
Before trading with real funds, it is always advisable to test the model and strategy through paper trading using virtual funds. Various tools and broker APIs offer paper trading functionality. Selecting tools that account for all trading expenses provides a realistic evaluation of strategy performance.
Live Trading Implementation and Environment Setup
After thoroughly testing the strategy and model, it is time to begin live trading. It is recommended to set up a stable and bug-free system in a cloud-based environment using familiar tools and brokers. By ensuring a reliable and robust setup, you can minimize unexpected surprises during live trading
Monitoring and Journaling
While our strategy is in operation, it is important to closely monitor its performance and record its results. Although trades are primarily executed automatically, we must exercise close attention to any undesirable trades that may arise due to bugs or highly volatile market movements that our strategy may not be adequately prepared for. While it is good to have confidence in the system we have created, it is equally important to maintain a composed mindset and remain in control during rare instances of crises or other unforeseen events.
Summary:
That sums up the article for now. I have outlined the most important aspects of the methodology in this post, but I will regularly write in-depth about each of the topics I mentioned here, as they cover extensive subject matter often found in entire books or numerous research papers. Once again, I want to highlight that it is a necessary and significant part of every research and implementation. I hope this post provides you with an overview of the quantitative research process and that you are curious to learn more. Feel free to like, comment, and subscribe if you enjoy my content. Until next time!