You might have noticed that in recent years there has been an increase in the popularity of financial markets, be it stocks, currencies, or cryptocurrencies. Almost anyone has a strong (but sometimes not very sound) opinion on whether a given asset is going “to the moon” or crashing down in flames.
The more rigorous and technical-minded retail investors have heard and even researched the topic of algorithmic trading, only to find out that an extensive array of topics must be covered before even creating a losing strategy.
The degree to which one has to master mathematics to succeed in algorithmic trading is a hot topic that is highly debated in classrooms and on internet forums. Whereas some people claim that a PhD. in Astrophysics is required, others state that only basic arithmetic skills are needed.
There sure has to be some common ground or truth on both sides. So, is mathematics required for algorithmic trading? If so, what topics are needed for being a successful algotrader?
A general knowledge of mathematics and a general ability in logical reasoning are core skills that algorithmic traders need to increase their chances of being successful in the industry. Every practitioner worth their salt should have a firm grasp of descriptive statistics, probability theory, linear algebra, calculus, and time-series analysis.
What math do you need for algorithmic trading?
Much has been said about the need for advanced degrees in Physics, Mathematics, or, at the very least, Electronic Engineering. This is almost always the case for sell-side analysts. These quants usually require a firm grasp of stochastic calculus, which requires previous exposure to real analysis, measure theory, ordinary differential equations, and partial differential equations.
On the other hand, algorithmic traders usually benefit from other branches of mathematics, especially the ones related to statistics. A deep understanding of the basics of statistics, econometric modeling, and machine learning is a significant advantage on the buy side. In a broader sense, optimization techniques are the most sought-after skills for these positions.
Counterintuitively, a degree in computer science is better suited than a master’s in financial engineering when it comes to algorithmic trading.
Simply put, algorithmic traders need to develop creative ways of finding patterns in their data. To do so, the following branches of mathematics are required to successfully backtest, implement and trade a new strategy they come up with.
When backtesting a strategy or evaluating the performance of a set of rules being used in actual live trading, it is necessary to understand the features and metrics of the results quantitatively.
These are, at the very least, measures of central tendency and measures of dispersion. The first is commonly known as averages, and the most popular are the mean, median, and mode. The most widely used measures of dispersion are range, variance, standard deviation, and quantile deviation.
Say that we develop a strategy that generates excess returns after adjusting for market-related volatility (alpha). Our hypothesis (null hypothesis) is that the strategy is not able to provide an above-market return.
Statistical inference estimates the probability of rejecting the null hypothesis (our strategy does not provide excess returns) when in reality, the null hypothesis is true. In other words, it is the probability of having a false positive.
Rejecting the null hypothesis with a higher degree of certainty is, of course, desired. As is commonly known, past results are not indicative of future performance, but inferential statistics provides a scientific way of rejecting useless strategies in favor of more valuable ones.
Understanding the basics of probability theory is the most helpful tool to detect a fake financial guru (the terms ‘fake’ and ‘financial guru’ are isomorphic).
It never ceases to amaze me how a new batch of people discover, recommend, and even use such senseless strategies as the martingale strategy every year. Thinking in terms of expected values is the key to spotting the flaw in the martingale strategy and losing all of your savings in just one sequence of bad outcomes.
Although linear algebra’s usefulness in algotrading is less straightforward than the previous branches covered, it is a pillar for further developing and understanding other branches.
Linear algebra is required to understand the ins and outs of linear regressions, time series in general, multivariable calculus, and a vast majority of machine learning algorithms.
Of course, it is not necessary to be able to pass a Linear Algebra exam at any given time, but it is advantageous to have had exposure to vector spaces, linear transformations, eigenvectors, and eigenspaces.
Given all of the above branches of mathematics that we mentioned, a basic understanding of calculus concepts is required to approach algorithmic trading seriously. It might not be required to know how to derive the formula of a normal distribution, but knowing what a derivative or an integral are is essential to understand intuitively, at least what is going on in a handful of models.
Much like Linear Algebra, Calculus is a prerequisite for machine learning. Important key concepts like gradient descent are impossible to understand without knowing what derivatives are.
The mathematical concepts that I’m mentioning in this article are mainly the ones that are valuable for stock and cryptocurrency trading.
If you’re interested in derivatives (such as options) then calculus is the most critical prerequisite you’ll study. Every single derivatives analyst has to know the Black-Scholes formula by heart. You might get by just learning the very basics of stochastic calculus. Still, plain old calculus is impossible to avoid if you don’t want to waste everybody’s time during an interview.
Econometrics or Time Series Analysis
I might be biased, but a decent knowledge of time series analysis will serve you well on your journey to algotrading. It is essential to know, at least intuitively, what linear regressions, auto-regressive (AR), moving average (MA), ARMA, ARIMA, SARIMA, and SARIMAX models do.
This seems daunting at first, but a careful reader might have noticed that I just added one extra letter at a time: “I” stands for “Integrated,” and “S” is shorthand for “Seasonal.” Finally, “X” tells us that the model incorporates exogenous variables.
We did not mention the need to have programming skills until now, but given that we are talking about algorithmic trading, I think it would be ridiculous not to take it as a given.
Python is the go-to choice if you want to learn a programming language just for algorithmic trading. This is not only due to the friendly learning curve but also because of the rich set of libraries that are useful for data science in general and time series analysis in particular.
Although having a formal background in data structures, algorithms, and complexity is always helpful, it is not required for most algorithmic trading use cases. The exception is when developing strategies that are very sensitive to latency, like high-frequency trading and market-making.
Helpful mathematical resources for algorithmic trading
Although it does not focus on finance or trading, the playlists of 3Blue1Brown are excellent resources to get you started or brush up on your skills. His linear algebra and calculus series are valuable for newcomers and professionals that took related courses at a university level. I especially recommend accompanying his videos with the material provided on his website.
- Probability: 3Blue1Brown on Probability
- Calculus: 3Blue1Brown on Calculus
- Linear Algebra: 3Blue1Brown on Linear Algebra
- Time Series Analysis: Duke University
After watching and reading these series, I recommend reading a book on brainteasers and puzzles commonly used during interviews for quants. I regularly read a puzzle or two from “A Practical Guide to Quantitative Financial Interviews” by Xinfeng Zhou.
Although this article deals with the mathematical concepts required for algotrading, it would not make sense to study these topics without simultaneously starting to code a few algorithms. For that, I recommend “Python for Algorithmic Trading” by Yves Hilpisch.
Having gone through all the main branches of mathematics usually used in algorithmic trading, it is worth noting that expert knowledge is useless without previous experience in the field itself.
Algorithmic trading is about the speed at which you can develop novel strategies, test them, and either discard them or improve them. A firm base of statistics, calculus, and linear algebra will impact the overall quality of your ideas and what you will be able to do with them, but there is no substitute for implementing multiple strategies and almost always having to discard them.