AI news sentiment analysis for trading – Proof of Concept

I aimed to experiment with automatically analysing multiple online news reports using AI to determine their positive or negative sentiment, which could then guide manual trading or potentially be used for automated trading.

I developed code that accepted a list of security names and ticker symbols from the FTSE100, for example:

3i,III
Admiral Group,ADM
Airtel Africa,AAF
Anglo American plc,AAL
Antofagasta plc,ANTO
Ashtead Group,AHT
Associated British Foods,ABF
AstraZeneca,AZN
...

The code queried Google News using the company name as a search term. For each news page returned, the code scraped and sanitised the text to extract the main content.

This content was then processed by the Llama3 large language model, with the prompt: “In relation to company profits, rate the following news item as positive, negative, or neutral? Give me a one-word answer:” A score was accumulated based on the results.

Although the experiment was intriguing, the results were inconclusive. The script functioned correctly, but hosting the LLM locally made it quite slow. Consequently, gathering sufficient data for a conclusion would take a very long time. Additionally, the data would need to be compared with actual subsequent market movements to identify any correlation.