Over the last few years we've looked at various tools to help us identify exploitable patterns in asset prices. In particular we have considered basic econometrics, statistical machine learning and Bayesian statistics.
While these are all great modern tools for data analysis, the vast majority of asset modeling in the industry still makes use of statistical time series analysis. In this article we are going to examine what time series analysis is, outline its scope and learn how we can apply the techniques to various frequencies of financial data.
Firstly, a time series is defined as some quantity that is measured sequentially in time over some interval.
In its broadest form, time series analysis is about inferring what has happened to a series of data points in the past and attempting to predict what will happen to it the future.
However, we are going to take a quantitative statistical approach to time series, by assuming that our time series are realisations of sequences of random variables. That is, we are going to assume that there is some underlying generating process for our time series based on one or more statistical distributions from which these variables are drawn.
Time series analysis attempts to understand the past and predict the future.
Such a sequence of random variables is known as a discrete-time stochastic process (DTSP). In quantitative trading we are concerned with attempting to fit statistical models to these DTSPs to infer underlying relationships between series or predict future values in order to generate trading signals.
Time series in general, including those outside of the financial world, often contain the following features:
Our goal as quantitative researchers is to identify trends, seasonal variations and correlation using statistical time series methods, and ultimately generate trading signals or filters based on inference or predictions.
Our approach will be to:
In addition we can apply standard (classical/frequentist or Bayesian) statistical tests to our time series models in order to justify certain behaviours, such as regime change in equity markets.
To date we have almost exclusively made use of C++ and Python for our trading strategy implementation. Both of these languages are "first class environments" for writing an entire trading stack. They both contain many libraries and allow an "end-to-end" construction of a trading system solely within that language.
Unfortunately, C++ and Python do not possess extensive statistical libraries. This is one of their shortcomings. For this reason we will be using the R statistical environment as a means of carrying out time series research. R is well-suited for the job due to the availability of time series libraries, statistical methods and straightforward plotting capabilities.
We will learn R in a problem-solving fashion, whereby new commands and syntax will be introduced as needed. Fortunately, there are plenty of extremely useful tutorials for R availabile on the internet and I will point them out as we go through the sequence of time series analysis articles.
Previous articles to date on the topics of statistical learning, econometrics and Bayesian analysis, have mostly been introductory in nature and haven't considered applications of such techniques to modern, high-frequency pricing information.
In order to apply some of the above techniques to higher frequency data we need a mathematical framework in which to unify our research. Time series analysis provides such a unification and allows us to discuss separate models within a statistical setting.
Eventually we will utilise Bayesian tools and machine learning techniques in conjunction with the following methods in order to forecast price level and direction, act as filters and determine "regime change", that is, determine when our time series have changed their underlying statistical behaviour.
Our time series roadmap is as follows. Each of the topics below will form its own article or set of articles. Once we've examined these methods in depth, we will be in a position to create some sophisticated modern models for examining high-frequency data.
My goal with QuantStart has always been to try and outline the mathematical and statistical framework for quantitative analysis and quantitative trading, from the basics through to the more advanced modern techniques.
To date we have spent the majority of the time on introductory and intermediate techniques. However, we are now going to turn our attention towards recent advanced techniques used in quantitative firms.
This will not only help those who wish to gain a career in the industry, but it will also give the quantitative retail traders among you a much broader toolkit of methods, as well as a unifying approach to trading.
Having worked in the industry previously, I can state with certainty that a substantial fraction of quantitative fund professionals use very sophisticated techniques to "hunt for alpha".
However, many of these firms are so large that they are not interested in "capacity constrained" strategies, i.e. those that aren't scalable above 1-2million USD. As retailers, if we can apply a sophisticated trading framework to these areas, we can achieve profitability over the long term.
We will eventually combine our articles on time series analysis, with the Bayesian approach to hypothesis testing and model selection, along with optimised C++, R and Python code, to produce non-linear, non-stationary time series models that can trade at high-frequency.
Now that the QSForex software has approached viability for high-frequency backtesting of multiple currency pairs, we have a ready-made framework for testing these models out, at least on the foreign exchange markets.
The next article in the series will discuss correlation and why it is one of the most fundamental aspects of time series analysis.comments powered by Disqus
You'll get instant access to a free 10-part email course packed with hints and tips to help you get started in quantitative trading!
Every week I'll send you a wrap of all activity on QuantStart so you'll never miss a post again.
Real, actionable quant trading tips with no nonsense.