Archived | Create a stress-test app for investment portfolios

Archived content

Archive date: 2019-05-01

This content is no longer being updated or maintained. The content is provided “as is.” Given the rapid evolution of technology, some content, steps, or illustrations may have changed.


Financial markets can be unpredictable, but investors want to know how their portfolios will perform under different conditions. This code pattern shows you how to build a stress-testing app for portfolios using a set of financial web services.


Financial markets are notoriously unpredictable. Interest rates, political developments, public mood – almost anything can affect an investment portfolio, both positively and negatively. Investors understandably want to know how their portfolio will react to different sets of circumstances, but too often they’re left to simply guess.

A company or organization that provides investment advice or services would see major business value in helping their customers view their portfolio under different sets of conditions. They would be able to show investors how their portfolio would react to market conditions; they could outline beneficial outcomes and prepare them to weather bad times. When it comes to investments, information is power.

Our team got to thinking: wouldn’t it be great if we could come up with an app that lets investors and financial companies see what different market conditions would do to a portfolio. We knew that there were some handy new IBM Cloud services available – we just needed to put them together to enable us to stress-test our portfolios.

This pattern is the result of that work. We show you how to use those IBM Cloud Finance services to perform predictive market stress testing for an investment portfolio. The services are integrated into a web interface that loads the user’s portfolio using the IBM Cloud Investment Portfolio service. You can fill in some basic information to create a scenario for stress testing; for example, what would happen to a specific portfolio if there was an overall 5% rise in the value of the S&P 500 Index.

The Predictive Market Stress Testing app that you’ll produce in this pattern lets you create different scenarios that are then applied to each holding in the portfolio using the IBM Cloud Simulated Instrument Analytics service. The pattern shows you how to use IBM Cloud Finance services to generate a robust, enterprise-grade stress test without having to have a PhD in Finance or Economics. It’s ideal for any developer who needs to understand stress-testing, predictive analytics, or multi-service app development.



  1. The user seeds the Investment Portfolio service with portfolio specific information before running the application.
  2. The user uses a web interface to provide inputs 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 previous step.
  5. The output is presented as a table in the web interface.


Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.