Build a financial stress-test app with natural language generation  

Create a stress-test app for a financial investment portfolio using cloud services and Arria NLG

Last updated | By Kevin Hoyt, Robert Hodgson, Raheel Zubairy

Description

In these volatile economic times, investors need to better understand the effects of different market conditions on their portfolios. This code pattern shows you how to build a stress-testing app for investment portfolios that has the added benefit of integration with natural language generation (NLG) so you can produce detailed, well-written portfolio analyses.

Overview

The financial markets are always on the move. Anyone with an investment portfolio knows how stressful it can be to watch the markets move and not know what the effects will be on their investment portfolio.

For developers, the challenge comes in providing insight and accurate predictions about how a portfolio might perform under a wide variety of conditions. In addition, we need to provide results that can be easily understood by financial advisors and the wider public. It doesn’t make sense to create a complex application if it can’t produce data and reports that are easily interpreted by the people who need the information.

This code pattern shows you how to compute a stress test using multiple services. You will apply the Predictive Market Scenario service and Simulated Instrument Analytics service to a set of investments maintained in the Investment Portfolio service. In addition, you will then narrate the results in the form of a textual report using the Arria NLG service.

The Investment Portfolio service manages and stores portfolios and financial security information, such as the set of eligible investments, benchmarks, and user portfolios. The Predictive Market Scenarios service generates a scenario representing an alternative, potential state of the market, which can then be applied to the assets in the Investment Portfolio service using the Simulated Instrument Analytics service.

The results that you generate will include observed correlations and co-variances of market risk factors (for example, interest rates, equity indexes, and foreign exchange rates), expected possible movements based on a user-defined market shock, and profits and losses for each asset in the investment portfolio. And because results from this kind of stress-testing can be difficult to interpret and parse for meaning, you’re also going to implement natural language generation. Instead of poring over complex data, you’ll pipe the results to the Arria NLG service, which generates a human-readable interpretation of the results.

This pattern walks you through the steps required to build a web app that integrates sophisticated analysis with innovative new NLG technology. You’ll create a simplified user interface that demonstrates how to collect information on any type of stress that the user wants to observe, and then formulates a narrative to be displayed alongside the charts and graphical representation of the results. For anyone looking to build in-demand, innovative, and practical skills in a financial development environment, this is the place to start.

Flow

  1. The user seeds the Investment Portfolio service with portfolio specific information before running the application.
  2. The user enters information to a web interface, such as the content of the portfolio, the risk factors, and the shock magnitude.
  3. The IBM Cloud Predictive Market Scenario service generates the scenario from the risk factor and shock magnitude inputs.
  4. The IBM Cloud Simulated Instrument Analytics service calculates the stressed value for each holding in the portfolio using the scenario generated in the previous step.
  5. The results are passed to the Arria NLG service to generate a narrative to be returned to the user alongside the numerical results.

Instructions

You will find detailed technical steps for this pattern in the GitHub repository’s README file. Those steps will show you how to:

  1. Create the Arria service.
  2. Create the IBM Cloud services.
  3. Clone the repository.
  4. Configure the .env file.
  5. Load the investment portfolio.
  6. Run the application.
  7. Deploy the application to IBM Cloud.

Related Blogs

Leveraging the power of AI at Unite Berlin

Last week, from June 19 – 21, we were at Unity’s premiere in Berlin: Unite 2018. This conference brought together Unity’s video game and development community. Unity touches 770 million gamers all over the world and is the market leader for consumer AR and VR use cases and is also rapidly emerging as the market...

Continue reading Leveraging the power of AI at Unite Berlin

Are You Developers? WeAreDevelopers, 2018

Earlier this year, we attended the WeAreDevelopers World Congress conference in Vienna. Named Europe’s largest playground for developers, founded as recently as 2015, the Congress has truly grown from strength to strength. From May 16th – 18th there were 8,000 participants, 250+ speakers, 100+ sponsors, who all convened in Austria’s capital for 3 days of...

Continue reading Are You Developers? WeAreDevelopers, 2018

Related Links

Arria NLG APIs

Add the power of language to applications, dashboards, and websites.