Over recent decades, the role of Computer Science in finance and economics has become markedly significant. Leading financial institutions are turning to computers for delivering outcomes. For instance, JP Morgan, Chase, and Barclays utilize supercomputers to assess the risk of a stock portfolio or forecast the future value of an asset. But how do they achieve this?
This article will delve into how computers evaluate sentiment and employ machine learning to optimize investment returns.
## Sentiment Analysis
The investment landscape has transitioned from relying on intuition to placing confidence in computer programs. The era of traders hurriedly buying and selling stocks on the trading floor is diminishing. Quantitative analysts, often referred to as quants, are taking the place of floor traders. Quants create computer algorithms heavily focused on mathematics to facilitate trading and predict stock performance.
Acknowledging the market’s evolution, Dow Jones has formulated a lexicon to enable computers to effectively assess stock movement potential. A synonym for lexicon is *dictionary*. The Dow Jones Lexicon (DJL) aggregates financial news and translates it into a format understandable by computers. Furthermore, the DJL consists of six distinct dictionaries, all developed by Bill McDonald, a finance professor at the University of Notre Dame. Nevertheless, financial firms have the option to develop their own dictionaries tailored to their specific requirements.
When a computer possesses a lexicon, it can differentiate between positive and negative news. This subsequently guides traders on whether it would be advisable to execute a trade for that stock.
Below is an illustration showing whether sentiment for a stock is bullish (positive) or bearish (negative).
Let’s examine a news article to see how the sentiment lexicon operates. This article originates from CNBC and was published on November 26, 2021, shortly after scientists in South Africa identified a new COVID variant.
This is the opening sentence of the article. You will notice that one of the initial words is “dropped.” A computer analyzing this fragment of text would categorize it as negative and lower the sentiment score, suggesting that the stock market is bearish. However, the position of the word is also critical. Keywords appearing in headlines or the opening lines carry more influence on the sentiment score than those hidden deeper in the text.
In this screenshot, you will observe keywords like “down,” “dropped,” “lost,” and “fell.” These words will be interpreted by the computer as negative, which results in a reduced sentiment score.
So, what does this look like from the computer’s perspective? It turns out that the process is relatively straightforward. Creating a sentiment analysis program involves using XML code. XML, which stands for extensible markup language, is closely related to HTML, though it is not an independent language. HTML dictates how a document should be presented, while XML details the data contained within that document. For instance, in HTML, there are tags that a programmer uses to create specific elements. The
tag defines a heading of a website (h for heading; 1 for the first heading). In contrast, XML allows a programmer to customize their code further. Rather than defining a generic
tag, XML enables the programmer to specify the tag as something like for clarity regarding what is being defined. This customization facilitates code interpretation and aligns with a business’s needs.
Note: the following code was compiled by sqlauthority.com
“`xml
White
Blue
Black
Green
Red
Apple
Pineapple
Grapes
Melon
“`
In the example above, quants or traders would follow a similar structure as shown, merely altering the tags to fit the specific requirements of an algorithm for sentiment analysis.
Sentiment analysis is just the beginning of what computers can accomplish on Wall Street. While it’s not feasible to cover everything, the article will proceed by exploring how Machine Learning plays a role in predicting market movements.
## Machine Learning
Machine Learning (ML) is a branch of Artificial Intelligence (AI) that collects information for systems like Siri to make informed decisions. In this case, instead of Siri, it pertains to computer algorithms. More information about ML and AI can be found in a previous article I wrote.
To ensure the highest likelihood of success, the computer must undergo training. Four characteristics of the stock are utilized for this training: its opening price, the day’s high, the low…