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.
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 apply the Predictive Market Scenario service and Simulated Instrument Analytics service to a set of investments maintained in the Investment Portfolio service. Then, you 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 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 implement natural language generation. Instead of poring over complex data, you 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.
- The user seeds the Investment Portfolio service with portfolio specific information before running the application.
- The user enters information to a web interface, such as the content of the portfolio, the risk factors, and the shock magnitude.
- The IBM Cloud Predictive Market Scenario service generates the scenario from the risk factor and shock magnitude inputs.
- 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.
- The results are passed to the Arria NLG service to generate a narrative to be returned to the user alongside the numerical results.
Find detailed technical steps for this code pattern in the README.md file in the GitHub repository.
- Create the Arria service.
- Create the IBM Cloud services.
- Clone the repository.
- Configure the .env file.
- Load the investment portfolio.
- Run the application.
- Deploy the application to IBM Cloud.