If you aspire to become a quantitative trader and build your own trading system, this guide covers some fundamental concepts.
Quantitative trading is an extremely complex field. Building your own strategy requires continuous learning and experimentation, which demands a significant time investment. Furthermore, you'll need programming expertise, and mastering a challenging language like C or Python is no small feat.
Today, we introduce some basic concepts for your reference:
A quantitative trading system consists of four main components:
- Strategy Identification – Finding strategies and determining trading frequency.
- Strategy Backtesting – Obtaining data, analyzing strategy performance, and eliminating biases.
- Execution System – Connecting to brokers, automating trading, and minimizing transaction costs.
- Risk Management – Determining optimal capital allocation and studying trading psychology.
We'll begin by understanding how to identify a trading strategy.
Strategy Identification
1. The Initial Research Phase
All quantitative trading processes begin with an initial research phase.
This involves finding a strategy, assessing its fit within your existing portfolio, acquiring the necessary data for testing, and attempting to optimize it for higher returns and lower risk.
You can explore various public resources to find exploitable strategies, such as theoretical results published by academia, strategies discussed on quantitative finance blogs, or ideas outlined in trading journals.
You might wonder why people discuss profitable strategies without fearing they'll be "crowded out." The reason is they rarely discuss the exact parameters and tweaks they implement. These optimizations are the key to transforming a relatively average idea into a highly profitable one.
In fact, one of the best ways to create your own unique strategy is to find a similar approach and then perform your own optimization process.
Here are some websites to start your search for strategy ideas:
- www.ssrn.com
- arxiv.org/archive/q-fin
- www.seekingalpha.com
- www.elitetrader.co
- www.nuclearphynance.com
- quantivity.wordpress.com
You'll likely find that many strategies you encounter fall into the categories of mean reversion and trend following/momentum.
- Mean reversion strategies exploit the theory that price series tend to revert to their long-term mean over time.
- Momentum strategies ride the wave of market trends, capitalizing on the investor psychology that trends can gather momentum in one direction, following the trend until it reverses.
2. Strategy Frequency
Another critical aspect of quantitative trading is the frequency of the strategy.
- Low-Frequency Trading (LFT) typically refers to strategies holding assets for longer than a trading day.
- High-Frequency Trading (HFT) usually involves holding assets intraday.
- Ultra-High-Frequency Trading (UHFT) involves holding assets for periods measured in seconds and milliseconds.
Once you've identified one or more strategy candidates, you need to test their profitability against historical data. This is the domain of backtesting.
Strategy Backtesting
The purpose of backtesting is to provide evidence that the strategy identified is profitable when applied to both historical and out-of-sample data. This sets expectations for the strategy's performance in the real world.
However, backtesting does not guarantee success for various reasons. This is perhaps the most nuanced area in quantitative trading, as it involves many biases that must be carefully considered and eliminated where possible.
Biases include look-ahead bias, survivorship bias, and optimization bias (also known as "data-snooping" bias). Other important considerations include the availability and cleanliness of historical data, accounting for realistic transaction costs, and having a robust backtesting platform.
Once a strategy is identified, you need to source historical data to test and potentially refine it. Numerous data vendors exist for all asset classes. Their cost typically increases with the quality, depth, and timeliness of the data.
The main concerns with historical data include accuracy/cleanliness, survivorship bias, and adjustments for corporate actions like dividends and stock splits:
1. Accuracy
Accuracy relates to the overall quality of the data—whether it contains errors. Errors are sometimes easy to spot, for instance using a spike filter to detect and correct incorrect spikes in time series data.
Sometimes, they can be very difficult to detect. It's often necessary to have two or more providers and cross-check all their data against each other.
2. Survivorship Bias
Survivorship bias is often a "feature" of free or cheap datasets. A dataset with survivorship bias means it does not contain assets that are no longer trading—for example, stocks that were delisted or went bankrupt.
This bias means any equity strategy tested on such a dataset will likely perform better than it would in the "real world," because the historical "winners" have been pre-selected.
3. Corporate Actions
"Actions" taken by companies often cause step-function changes in the raw price that shouldn't be included in return calculations. Adjustments for dividends and stock splits are common examples.
Each of these actions requires a process called back-adjustment. Great care must be taken not to confuse a stock split with a genuine return adjustment.
To perform the backtesting process, a software platform is necessary. Options range from dedicated backtesting software (like Tradestation), numerical platforms (like Excel or MATLAB), to fully custom implementations using programming languages like Python or C++.
Often, creating a complete in-house technology stack is optimal. For HFT strategies, using a custom implementation for backtesting is essential.
When backtesting a system, you must be able to quantify its performance. The "industry standard" metrics for quantitative strategies are Maximum Drawdown and the Sharpe Ratio.
- Maximum Drawdown
Maximum Drawdown is the largest peak-to-trough decline in the account equity curve over a specific period (usually a year), typically presented as a percentage. Due to statistical factors, LFT strategies often experience larger drawdowns than HFT strategies. Historical backtests reveal past maximum drawdown, serving as a guide for future expectations.
- Sharpe Ratio
The Sharpe Ratio is defined as the average of excess returns divided by the standard deviation of those excess returns.
Here, excess returns refer to the strategy's returns above a predetermined benchmark, such as the S&P 500 or 3-month T-bills. Annualized return isn't commonly used as a standalone metric because it doesn't account for the strategy's volatility.
Once a strategy has been backtested, deemed free of biases, and shows a good Sharpe Ratio and minimal drawdown, it's time to build an execution system.
Execution System
The execution system is the vehicle that turns the strategy into a list of trades. The execution mechanism can be manual, semi-manual (i.e., "one-click"), or fully automated. For HFT strategies, a fully automated execution mechanism, often tightly coupled with the trade generator, is necessary.
Key considerations when creating an execution system include interfacing with the broker, minimizing transaction costs (including commissions, slippage, and spread), and the divergence between live system performance and backtest results.
1. Broker Interface
There are many ways to interface with a brokerage. The optimal method is a fully automated, high-performance Application Programming Interface (API). Automating trade execution frees up your time for further research and allows you to run multiple strategies, potentially at higher frequencies.
Common backtesting platforms like MATLAB, Excel, and Tradestation are suitable for lower-frequency, simpler strategies. However, for any true HFT, it's necessary to build an in-house execution system using a high-performance language like C++.
For instance, consider a live trading case with a 10-minute "trading loop"—downloading new market data and executing trades based on it within that 10-minute window. For anything approaching minute or second frequency data, C/C++ becomes far more ideal.
In larger funds, optimizing execution is often not the quant trader's domain. However, in smaller prop shops or HFT firms, the trader is the executor, thus requiring a broader skill set. If you aim to work at such firms, programming skills will be at least as important, if not more so, than statistical and econometric talent!
2. Minimizing Transaction Costs
Transaction costs typically consist of three components:
- Commissions
Commissions (or taxes/fees) charged by brokers, exchanges, and government regulators.
- Slippage
Slippage, the difference between the price you intended to execute an order at and the price at which it was actually filled.
- Spread
Spread, the difference between the bid and ask price of the security being traded.
Note that the spread is not constant; it depends on the current liquidity (availability of buy/sell orders) in the market.
Transaction costs can determine the net profitability of a strategy, and accurately predicting them from backtests can be challenging.
In live trading, entire quantitative teams focus on optimizing strategy execution. For instance, when needing to sell a large position, "dumping" so many shares into the market would quickly depress the price, preventing best execution. Using an algorithm to "drip-feed" the order into the market risks slippage. In live trading, adaptation is constant.
3. Live System Performance vs. Backtest Performance
The final major issue for execution systems is the divergence between live strategy performance and backtest results. This can happen for many reasons, such as look-ahead bias or optimization bias during backtesting.
However, some strategies make it difficult to test for these biases before deployment. Particularly in HFT, there can be bugs in the execution system or the strategy logic itself that don't appear in backtests but surface in live trading.
Risk Management
The final piece of the quantitative trading puzzle is the risk management process.
"Risk" encompasses all the bugs discussed previously, including systemic risk, political risk, and technological risk, such as a sudden hard drive failure on a server co-located at an exchange. It covers everything that can interfere with the realization of a trade.
Risk management also includes what's known as optimal capital allocation, a branch of portfolio theory. This is the means of distributing capital among a set of different strategies and the trades within them—a complex field.
Another key component of risk management is dealing with your own psychology. Common examples include loss aversion—the fear of realizing a loss or giving back unrealized profits. Another common psychological pitfall is recency bias, which manifests when a trader places too much emphasis on recent events over long-term ones.
And, of course, the classic emotional pairing—fear and greed. These often lead to being under-leveraged or over-leveraged, which can lead to ruin or reduced profits respectively.
Conclusion
Quantitative trading is extremely complex yet fascinating. Even basic concepts require substantial explanation. Therefore, entering the field demands significant knowledge accumulation—at minimum, a strong background in statistics and mathematics, along with proficiency in programming languages like C and Python.
If you aspire to research and develop complex strategies in the HFT space, you'll need to further expand your skillset to include areas like Linux kernel modification, C/C++, assembly programming, and network latency optimization.
In practice, try to build as much as possible yourself—your own data collectors, strategy backtesters, and execution systems.
Welcome to our Blog!
If you are interested in career opportunities, please send your CV to: recruiter@alphamaker.link
If you would like to share your story, please contact us on WeChat: AMQuantcareer