Trading using LLM: Generative AI & Sentiment Analysis in Finance – Part I

    Date:

    In recent years, large language models (LLMs) like GPT-4 have revolutionised various industries, including finance. These powerful models, capable of processing vast amounts of unstructured text, are increasingly being used by professional traders to gain insights into market sentiment, develop trading strategies, and automate complex financial tasks.

    You must be aware of how sentiment analysis is being done by traders with the help of news, but if you wish to learn more about the same, you can enrol into this course with the link here.

    In this blog, you will explore how LLMs are integrated into trading workflows, using tools like FinBERT, Whisper, and more to enhance decision-making and performance.

    Please note that we have prepared the content in this article almost entirely from a QuantInsti course by Dr. Hamlet Medina and Dr. Ernest Chan.

    About the speakers

    Dr Ernest Chan is the CEO of Predictnow.ai and Dr Hamlet Medina is the Chief Data Scientist, Criteo and in the webinar, they discuss how LLMs can help us analyse the sentiment of event transcripts.

    Visit QuantInsti to watch the webinar.

    Here is what this blog covers:

    • What is an LLM or a Generative AI?
    • How can LLMs be improved?
    • What are financial LLMs?
    • The role of sentiment analysis in trading using LLMs
    • Sentiment analysis trading process
    • Sentiment analysis of FOMC transcripts
    • Real-world applications
    • LLM models that help with sentiment analysis
    • How to understand sentiment scores?
    • FAQs

    What is an LLM or a Generative AI?

    A Large Language Model (LLM) is a generative AI that understands and generates human-like text. Models like OpenAI’s GPT or Google’s BERT are trained on massive amounts of data, such as books, articles, and websites. These models are built using billions of parameters, which help them perform tasks like answering questions, summarising information, translating languages, and analysing sentiment.

    They are called generative AIs because unlike traditional AI, which typically focuses on recognising patterns or making decisions based on existing data, generative AI can produce original outputs by predicting what comes next in a sequence.

    Because of their flexibility, LLMs are used in many fields, including finance, healthcare, law, and customer service. In finance, for example, LLMs can analyse news, reports, or social media to provide insights for market predictions, risk management, and strategy development.

    For instance, given the sentence, “Due to the pandemic declaration, the S&P 500,” an LLM might predict “declined” as the next word based on the previous words.

    Figure: Prediction by LLMs

    How are LLMs able to predict the next word?

    You can use any data you have access to for training the LLM model. In fact, you can use the entire internet to train the LLM. Once you have given the input, the LLM will give you an output. Further, it will check the predicted output with the actual output variable and based on the error, it will adjust its prediction accordingly. This process, called pre-training, is the foundation of how LLMs understand language.

    This was about the introduction of LLMs, but if you wish to learn more about the particular LLM model known as “ChatGPT” and how it can help with trading, you must read this blog here.

    This blog covers almost everything that you need to know about trading with ChatGPT including the steps of implementation using prompts. Also, the blog will take you through ChatGPT’s machine learning usage, strategies, the future and so much more!

    Further, we will continue the discussion about LLMs and then find out how they can be improved to maximise their use.

    How can LLMs be improved?

    After pre-training, LLMs are often further enhanced through techniques like Reinforcement Learning through Human Feedback (RLHF) conducted by specialised teams within organisations (such as ChatGPT and OpenAI) that develop LLMs. In RLHF, human reviewers rank multiple outputs generated by the LLM.

    For example, for a given sentence, outputs like “declined,” “exploded,” or “jumped” might be produced, with “declined” being ranked the highest by human reviewers as shown in the image below.

    Figure: Multiple Output Prediction by LLMs

    The model then learns from these rankings, improving its predictions for future tasks.

    Figure: Ranking of LLM Output by Human Reviewers

    Further, let us discuss the meaning of financial LLMs and their use in trading.

    What are financial LLMs?

    While general-purpose LLMs are helpful, models trained on specific data types perform even better for niche tasks. This is where financial LLMs come in. Models like BloombergGPT and FinBERT have been fine-tuned on financial datasets, allowing them to better understand and predict outcomes within the financial sector.

    For instance, FinBERT is trained on top of the BERT model using datasets from financial news articles and financial phrase banks, enabling it to capture the nuances of finance-specific language.

    Figure: Training of FinBERT
    Next, let us check out the role of sentiment analysis in trading using LLMs.

    The role of sentiment analysis in trading using LLMs

    Dr. Hamlet Medina explains how one of the alternative data techniques, that is, sentiment analysis plays a critical role in finance by converting qualitative data, such as news articles, speeches, and reports, into quantitative insights that can influence trading strategies.

    By leveraging advanced natural language processing (NLP) models like ChatGPT, financial institutions can systematically assess the sentiment behind news reports or statements from influential figures, such as central bank officials, and use this information to make informed market decisions.

    Sentiment analysis in this context involves determining whether the tone of a news article or speech is positive, negative, or neutral. This sentiment can reflect market conditions, investor confidence, or potential economic shifts. Dr. Medina highlights that models like ChatGPT are trained on vast datasets, allowing them to recognise patterns in language and sentiment across different sources. These models then evaluate the emotional and factual content of texts, extracting insights about market direction or volatility.

    For example, if a central bank statement suggests a cautious economic outlook, sentiment analysis could flag this as a potential signal for market downturns, prompting traders to adjust their positions accordingly. By translating complex linguistic data into actionable insights, sentiment analysis tools have become essential for predictive modelling and risk management in modern finance.

    Further, to develop your career in modern methods in finance, there is this course that covers various aspects of trading, investment decisions & applications using News Analytics, Sentiment Analysis and Alternative Data. This course is titled Certificate in Sentiment Analysis and Alternative Data for Finance (CSAF) and you can access it here.

    Let us now see what is meant by the sentiment analysis trading process.

    Sentiment analysis trading process

    The sentiment analysis trading process involves a series of steps that transform raw financial text data into actionable trading insights. Here’s a streamlined approach that traders can follow:

    Figure: Sentiment Analysis Trading Process

    1. Data Collection: Gather raw data from sources like FOMC transcripts or earnings calls. This can be in text, audio, or video form from official websites.
    2. Data Preprocessing: Clean the data by transcribing, removing irrelevant content, and segmenting it to ensure it’s ready for analysis.
    3. Sentiment Scoring: Use models like FinBERT to assign sentiment scores (positive, negative, or neutral) to the processed data.
    4. Trading Strategy: Apply these sentiment scores to your strategy by setting thresholds to trigger trades based on market sentiment shifts during key events.
    5. Performance Analysis: Evaluate both strategy and trade-level performance to study profitability.

    This process allows traders to effectively incorporate sentiment analysis into their trading strategies for better decision-making.

    Let’s understand how this sentiment analysis trading process is applied to analyse the FOMC transcripts and trade as per the sentiment.

    Stay tuned for the next installment to learn about sentiment analysis of FOMC transcripts

    Originally posted on QuantInsti.

    Disclosure: Interactive Brokers

    Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

    This material is from QuantInsti and is being posted with its permission. The views expressed in this material are solely those of the author and/or QuantInsti and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

    Go Source

    Chart

    SignUp For Breaking Alerts

    New Graphic

    We respect your email privacy

    Share post:

    Popular

    More like this
    Related

    Advanced Time Series Analysis in Finance

    The article “Advanced Time Series Analysis in Finance” was...

    A Spooky End to the Month; Looking to AAPL and AMZN

    This morning, Halloween is bringing tricks, not treats to...

    StockTok: Reddit third quarter results spark share surge

    Meta and TikTok face lawsuits in Brazil, xAI valued...

    Post-Election Risks? What Chip Companies and a Railroad Could Signal at Upcoming Analyst Days​

    AI enthusiasm remains high, but macro uncertainty could be...