As VI Company, we develop (and host) software for the financial and capital markets. Our work ranges from creating dashboards to building complete OTC exchanges and institutional retail broker platforms. We cater to both the institutional buy side and sell side, as well as the "plumbers" in between, such as exchanges, custodians, brokers, and more.

Many of our clients hold a broad range of portfolio investments, from exotic derivatives to equity and fixed income holdings. A key task for portfolio managers and their clients is to provide insights into investment portfolios. This is often done through detailed drill-down, slice-and-dice dashboarding. Sometimes the dashboards are completely custom-made, while other times they are created in a hybrid form using PowerBI. Dashboards are great, but it still requires the user to interpret the data. It begs the question; does it provide you with all the relevant insights in real time?

Proactive Exposure Discovery

Imagine you're a pension board trustee watching the news, and a particular news item makes you wonder, "how does this affect my investment portfolio?" The usual approach would be to grab your iPad, log in, and start filtering and drilling down into your portfolio until you understand the probable exposure.

What if this process could be automated? This is where our News and Exposure Monitor prototype (NEXMO) comes into play. Imagine automatically importing breaking news items and relating them to your portfolio. For this to be possible, you need a robust data set. For instance, the news message must clearly contain countries, sectors, companies, etc., and on the other hand, your investment portfolio must be well-tagged to make the link.

Enter AI

OpenAI GPT (the engine powering ChatGPT) excels at interpreting free-form text (such as news articles) and digging into portfolio holdings to discover potential correlations. This capability eliminates the need for extensive enhancement of your portfolio data with often expensive metadata or manual interpretation of news items.

It is worth noting that both OpenAI API set and ChatGPT are products of AI training. However, there are distinct differences between ChatGPT and the OpenAI API set. ChatGPT is predominantly used by the general public to interact with AI-powered text generation, while the OpenAI API set is primarily intended for developers to access APIs. The API set offers additional technical capabilities, such as the ability to format responses in JSON or select alternative machine learning models besides the GPT model.

Next step: Proactive exposure reporting

For now, we've made a public prototype for you to experiment with. Behind the scenes, we're implementing this system for clients, enabling breaking news items to be automatically picked up and correlated to their portfolios.

Privacy: not sharing portfolio weights

We use the paid OpenAI license. Their data usage policy states: "OpenAI will not use data submitted by customers via our API to train or improve our models unless you explicitly decide to share your data with us for this purpose. You can opt in to share data." On top of that, we do not share any exact portfolio holdings data. Essentially, we only share a set of tickers and the news article. We receive back the tickers that are related and then internally enrich that data with the actual weights to calculate exposure.

Limitations

Despite its impressive capabilities, AI isn't infallible and may not always produce entirely accurate results. We've found that OpenAI is most reliable with plain equity tickers. It's less reliable with fixed income or more exotic holdings. For this reason, we currently focus solely on equity holdings. Additionally, the use of (Open) AI comes with other limitations and flaws, such as its understanding of context and its ability to accurately interpret complex or ambiguous information. 

One of these limitations is the inherent bias that can occur in AI models. These biases are often a reflection of the data used to train the models. In practical terms, if the training data over-represents certain types of investments, regions, or sectors, the AI may produce skewed results. If certain information is underrepresented in its training data, it might fail to make the right connections or produce insightful output.

Lastly, while AI can assist with understanding portfolio exposure by correlating news items to specific holdings, it's not a substitute for human judgment and expert analysis. It can provide valuable insights and aid decision-making processes, but the ultimate responsibility for investment decisions lies with the human users. It is always advisable to combine AI's insights with those from financial advisors, portfolio managers, and other experts in the field. That is why we view this NEXMO prototype as just one tool in a broader, more comprehensive investment strategy.

So, how did we do this?

Getting Started

At the start of the project, the idea emerged to leverage OpenAI's capabilities for analyzing news and assessing its impact on investment portfolios. To facilitate this, we initiated the development of an API wrapper around the OpenAI API set. Our initial focus was to establish a suitable mechanism for restricting the nature of the responses received from OpenAI.

To achieve this, we devised a process where the request is divided into two distinct messages. The first message serves as our system message, enabling us to define specific settings and preferences. Within this system message, we have the ability to configure various parameters.

I would like a JSON response, with the following properties; -- The first property named isNewsRelevant indicating whether the news message content relates to any of the tickers-- The second property named newsRelevanceExplanation with the explanation why the news message is related to the portfolio, and whether the effects are positive or negative-- The third property named affectedTickers, containing an array of the tickers which the news message is related to

The second message in the request would contain the user's news input, which can be a news article or just a headline. Lets take this CNBC articleon Tesla’s second quarter production and delivery report for 2023 as an example. 

The input for this second message would look like this:

Tickers": ["A","AAL","AAP","AAPL","ABBV","ABC","ABT", etc.],NewsMessageContent": "Tesla posted its second-quarter vehicle production and delivery report for 2023 on Sunday.Here are the key numbers from the electric vehicle maker: Total deliveries Q2 2023: 466,140 Total production Q2 2023: 479,700 The numbers beat analysts' expectations and indicate that deliveries rose 83% year-over-year for Tesla after Elon Musk's auto business added manufacturing capacity, and ramped up production at its vehicle assembly plant in Austin, Texas.

The response that is produced by OpenAI would have this format:

"isNewsRelevant": true,"newsRelevanceExplanation": "The news message is related to the portfolio because it pertains to Tesla which is part of the investment portfolio. It mentions that Tesla has beaten analysts expectations with an increase of 83% in deliveries year-on-year after expanding its manufacturing capacity. This is generally positive news, as it indicates growth and successful expansion efforts, potentially leading to a positive impact on stock performance.","affectedTickers": [ "TSLA" ]

Once we achieved successful testing and ensured consistent response formats, we proceeded to build a web application around our API. Initially, we developed a proof of concept, and subsequently, we created user stories to guide the implementation using the Scrum methodology. Over the course of a few weeks, the product evolved into its current state.

Architecture

The software architecture of the prototype consists of two applications: an ASP.NET Core MVC app and an Azure Functions app. The MVC app operates within a Web App, while the Azure Functions app runs within a Function App on the Azure platform. The Function App primarily handles the execution of small, fast-running code snippets. All interactions with OpenAI are performed through the Azure Functions. The MVC app calls the Azure Functions app as an API to request a calculations from the OpenAI model.

In order to effectively utilize data obtained from OpenAI, it must be properly structured. Otherwise our application cannot interpret the data. One common method of structuring data is by using JSON. JSON is a lightweight data interchange format commonly employed for transmitting data between servers and websites.

In the frontend of our application, we incorporated technologies such as reCAPTCHA and a rate limiter, while also ensuring the correct implementation of security headers. These measures were put in place to deliver a smooth user experience and mitigate the impact of bots.

Data & Costs

OpenAI maintains transparency regarding the use of their API. In the OpenAI policies, it is explicitly stated that data submitted to the API is not utilized for model improvement. Instead, the data is retained for a period of 30 days for the purpose of monitoring and preventing abuse or misuse.

The usage of the OpenAI API set is not free. OpenAI charges a fee of $0.03 for every 1,000 tokens in the input and $0.06 for every 1,000 tokens in the output. To provide an estimation, 1,000 tokens approximately corresponds to 750 words. A token is not the same as a single character. In the current paragraph, the total token count is around 69.

Tickers

Within our application, each ticker in the portfolio is assigned a fixed weight, which remains constant. As mentioned before, for privacy reasons, we do not share the portfolio holdings data to the OpenAI API set. However, this also serves another purpose: reducing the token count in the API request. Hence, we exclude the portfolio weights for each ticker when sending information to the OpenAI API set. For example, the S&P 500 index comprises 500 companies, leading to a reduction of approximately 500 tokens in the input message.

During our project we encountered certain limitations associated with the GPT-4 model, which is the latest OpenAI release. One issue arose when users submitted news articles that had a significant impact. In such cases, the model occasionally generated an output containing an invalid array of tickers sourced from the S&P 500.

To address this problem, we implemented a parsing mechanism to identify and rectify the array of tickers. This allowed us to ensure the array could be properly serialized in C# and integrated into our system. Additionally, we observed that the model occasionally required up to two minutes of processing time to generate a response.

Conclusion

With this prototype we have leveraged the power of OpenAI's GPT model to automate the correlation between breaking news items and investment portfolios. While there are limitations and biases inherent in AI models, the technology provides valuable insights and complements human judgment in investment decision-making. 

With robust software architecture and careful consideration for privacy, we continue to provide the financial industry with innovative solutions. 

Want to take our NEXMO prototype for a spin? Check out: https://portfolio-openai.vi.company/


Kees de Koning

Founder & CEO

I'm a firm believer that a company is created with a purpose and with a like-minded, diverse group of great, intelligent individuals that can form a great group. A group who is able to carry and feel the team responsibility for a (group of) client(s) and the company.

Kees de Koning

Founder & CEO

I'm a firm believer that a company is created with a purpose and with a like-minded, diverse group of great, intelligent individuals that can form a great group. A group who is able to carry and feel the team responsibility for a (group of) client(s) and the company.

Kees de Koning

Founder & CEO

I'm a firm believer that a company is created with a purpose and with a like-minded, diverse group of great, intelligent individuals that can form a great group. A group who is able to carry and feel the team responsibility for a (group of) client(s) and the company.

SHARE ON SOCIAL MEDIA

Start working with our domain experienced engineers.

Your project is definitely in the right hands.

Call to action image

Start working with our domain experienced engineers.

Your project is definitely in the right hands.

Call to action image

Start working with our domain experienced engineers.

Your project is definitely in the right hands.

Call to action image