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

Jax 2018 – Just An Awesome Experience

What a week! From 23rd to 27th April our Berlin team attended the Jax conference in Mainz, Germany. We had such a great time sharing our fresh perspectives, in the form of a rousing keynote and two informative sessions. The concept of this annual event with over 2,000 participants, revolves around innovating with Java, architecture,...

Continue reading Jax 2018 – Just An Awesome Experience

CloudNativeCon and KubeCon are coming to Copenhagen!

With May just around the corner, mark your calendars for an exciting event, CloudNativeCon/KubeCon, in Denmark’s capital city of Copenhagen. Many of us in the Cloud Native community already visited this beautiful city for DockerCon EU last year and we’re excited to be able to take in all of the wonderful sites again this year....

Continue reading CloudNativeCon and KubeCon are coming to Copenhagen!

Live analytics with an event store fed from Java and analyzed in Jupyter Notebook

Event-driven analytics requires a data management system that can scale to allow a high rate of incoming events while optimizing to allow immediate analytics. IBM Db2 Event Store extends Apache Spark to provide accelerated queries and lightning fast inserts. This code pattern is a simple introduction to get you started with event-driven analytics. You can...

Continue reading Live analytics with an event store fed from Java and analyzed in Jupyter Notebook

Related Links

Arria NLG APIs

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