
This article is a part of a series on quantitative finance developed by “Quantitative Strategies Academy” Foundation according to its mission for the benefit of people who want to know more about quantitative analysis and automated systems.
Quantitative finance is a method of training and analyzing financial markets which takes advantage of mathematical models and large datasets. This method is used in various areas of finance, such as in the pricing of derivatives or risk management.
Within quantitative finance, various sub-methods and models are in use. In this article, we’ll discuss one of them in detail: algorithmic methods. We’ll explore what they are and review the basics you need to know on the subject.
What is an algorithm?
Before we start discussing algorithmic methods, let’s see what an algorithm is. Put simply, it’s a predefined set of instructions that need to be performed in a certain order, and/or according to a certain logic, in order to get the desired end result.
Let’s take eating an orange as an example. You perform a certain number of steps in a particular order to get that task done:
Take the orange from the bowl of fruit.
Peel it.
Cut it into pieces.
Only after you have made those steps in that order, the orange is ready to eat. You could call these steps an algorithm for eating an orange.
In trading, we can use algorithms (much more complicated than the one in the example above, of course) to analyze the data we have on a certain market or security, and base our decisions on the results that algorithms give us. It should be noted here that the final decision is still made by us and we’re the ones placing the final order, based on the data provided by the algorithmic analysis. If we allowed the system to make the actual decisions and our next steps based on the result from the algorithm, that would constitute automated trading.
A few words on the basics and history of algorithmic trading
Back in the days of trading, it was done entirely on paper. In order to trade stocks, for example, you needed to be present at the floor of a brokerage to get the actual work done, or appoint a broker who would be there and do the operations for you. (Actually, in such cases there may have been a modicum of algorithmic trading present even back in those days if we factor in the rules that many brokers set for themselves and followed when analyzing their data and making decisions.)
Gradually, a process called dematerialization, also known as DEMAT, took place. It means that the electronic equivalents slowly replaced paper certificates which were physically traded at floors. That process allowed the process to start happening electronically as well. With introducing computer systems into the equation, things changed even further. Since computers act much more quickly than humans, using them for storage and transfer of certificates also allowed all that process to happen much faster than before.
Since computers work with algorithms (that’s the way to program a computer), the next logical step in the evolution of the process was to start using algorithms to make decisions according to predefined sets of criteria. That’s a commonly used method because a computer is much better at following and performing algorithms without errors than any human can be, as well as faster. Even if you used the same algorithm to analyze data that your computer would, chances are it would take you days, if not longer, to arrive at the same decision that your computer would make in a few minutes.
Furthermore, using a computer system is the only way to take the next step and make the process fully automated. That would bring its own set of advantages and disadvantages, mainly related to the way a computer “thinks”. Since computers only work with algorithms, when making a decision even the most complex AI would factor in only the things resulting from the data it got from the algorithm, and not relate it to anything else – it couldn’t think of it the way a human would when looking at the end result of algorithmic analysis, unless the data of the thing (such as a political event affecting a certain local market, for example) wasn’t factored into the data which was fed into the algorithm in the first place. On the other hand, what may in some circumstances seem like a disadvantage – the computer being just a calculating machine with no emotions whatsoever – could also be the greatest advantage of computer systems, algorithmic analysis and automated processes. If you have spent even a small amount of time trading, you have encountered emotional responses – in yourself, in others or both – to events where “cold, harsh” calculations should have taken place instead. We keep on trying to make sure that things such as fear or greed don’t affect us but in reality, no human being can be fully isolated from their emotions. It doesn’t matter how hard we try, humans will remain human. Therefore, in some cases, it may make more sense to resort to full automation, set the algorithms that would make the decisions when we’re in a calm and calculating state of mind, and then let the system make the day-to-day decisions and actual activity for us.

Structure of an algorithmic system
Let’s dive deeper into the typical intelligent algorithmic system, and see what it consists of and how each component of it is used.
Data component
Every algorithm used for trading needs an input of data to analyze upon which to make its decisions. Therefore, the data you feed into it is of paramount importance to the end result and may make the difference between a huge win or a substantial loss.
The data you can feed into an algorithm can be structured or unstructured.
Structured data is sorted in accordance with a certain format and set of criteria, thus making it easier to sort, go through and analyze, especially for a computer. Humans handle unstructured data fairly well, but it’s not that easy for most computer algorithms to make sense of it, or derive meaningful data out of it.
Examples of structured data are databases, files in XML or JSON format, or the data published by reputable online services which follow stock markets and report them online. An algorithm can directly use such data.
Unstructured data, on the other hand, looks extremely messy to any algorithm in its original form. An example of unstructured data is information taken from social media or an article in a financial newspaper about the performance of the economy in a given sector. It’s pretty easy for any human being to derive meaningful information out of such a source of unstructured data, and it usually provides an additional layer of information which can’t be presented as easily in a structured form. However, raw unstructured data is rather difficult for an algorithm to analyze, and you couldn’t rely on it getting all the nuance the data may contain or taking the most advantage out of it.
To aid algorithms in that, several tools exist, and they have seen rather rapid development recently, with the advance of AI and neural networks. Such tools utilize data analytics and data mining techniques to extract quantifiable meaning out of unstructured data, such as financial news from major media outlets, and feed it into an algorithm in a form that it can use.
Model component
To further help the algorithm make sense if the inherently complex thing that our reality is, the model component exists. Models represent the way the system thinks the world works, and hence makes predictions about how financial models would work and apply to that reality.
The most commonly used approaches for creating financial models rely on mathematical models, symbolic or fuzzy logic systems, decision trees, induction rule sets, and neural networks. They can be used separately or in a variety of combinations. The purpose is always the same: to turn the fuzzy and messy “real world” with all of its intricacies into a quantifiable model that an algorithm can use for making calculations, and thereby to arrive at predictions and decisions based on data.
Execution component
After our system has performed all the analysis that it can do, based on the data we fed into it, it’s time for execution. Whether as part of an automated process where the system will execute on the decisions without human interference or as a way to present decisions in human-readable form for us to act upon, any algorithmic system needs a component that presents us with a strategy we can execute in our day-to-day work.
In order for this component to do what it was intended to in the best possible way, we need to have several requirements in mind and set them up from the onset. Those include our desired execution speed, trading frequency, the period for which trades are held, and the method by which orders are routed to the exchange. When setting up the algorithmic system, we need to make sure it will execute in compliance with these requirements and feed them into the system as well as the data.
Monitor component
After the initial setup, a good algorithmic system needs to be able not only to analyze and execute well but also to analyze the results, and even adapt its further strategy based on the results from that analysis. Again, analysis can also be done by humans, but the pros and cons of that approach discussed above apply to analysis just as well, especially having in mind that any future decisions would be based on the results, and the end goal would be to optimize the system as much as possible. Therefore, it would make sense to trust the system with the results analysis and optimization decisions, the same way we did it with the initial data analysis.
Most computer systems are perfect at analyzing data and arriving at conclusions based on that. Still, again, we have the same fundamental issue with data that we mentioned above: the system can only factor in data it already knows about. We also know that markets change constantly and rapidly and that any indicators of past performance aren’t necessarily a guarantee for future performance as well. (Actually, more often than not, the opposite is true.) Therefore, AI needs to be included at this point, to make sure the system can also factor in other circumstances beyond the raw data, and that it can learn from the results it already has, in order to make better decisions and predictions with every iteration.
In order to do that, AI needs to learn well. It learns using objective functions. Objective functions are mathematical functions which quantify all the actual, real-world data combined with past performance results, and turn it into structured data which the system can understand. In the context of finance, several popular measures exist, such as the Treynor ratio, Sharpe ratio, and Sortino ratio.
There’s another challenge with analysis: since, as we mentioned already, markets are extremely dynamic and notoriously hard to predict, the models which worked well up to a point in time may stop working as well as time passes – suddenly or gradually. There is a way to circumvent this, however: the algorithmic system should train the models with information about the models themselves. In this way, the system will analyze not just the data itself but it will also be constantly on the lookout whether the model is still applicable in accordance with the data, and if not, change it as needed.
Having in mind the basics of an algorithmic system outlined above, in the next articles of our series we’ll explore in more detail what skills and tools you would need to apply the aforementioned in your practice.
Sources:
1) Towards Data Science blog: Algo Trading 101
2) Quantstart: Beginner's Guide to Quantitative Trading
3) Corporate Finance Institute: What is Quantitative Finance?
Disclaimer: This is an educational website operated and maintained by “Quantitative Strategies Academy” Foundation. No part of the content of this website constitutes a recommendation to apply any investment strategies presented or implied in any of the site content. No part of this website or its content should be considered any type of investment or other advice related to your personal circumstances. You must take independent financial advice from a qualified professional when making any type of financial decision which may or may not be directly related to information found on this website.