Taxonomy Icon

Artificial Intelligence

Create an app to get stock information, prices, and sentiment

Get the code View the demo

Summary

In the world of investments, there are many things to take into consideration. Along with the normal metrics such as price and earnings, there are other factors that you need to make an informed decision, factors such as sentiments about a company. This code pattern shows you how to create an app that uses Watson Discovery, Node.js, and Cloudant NoSQL DB to help you with these decisions. You can then use it as a guide to jump-start your own coding projects.

Description

Investing in the stock market can be tricky because there are many metrics to consider. Things like price, price-earnings ratios, alphas, price-to-book, and free cash flow are just a few of the factors to think about. There is also the qualitative data that comes from news sources. Data that can help you make investment decisions around a company’s future value based on positive or negative news. To help you with these decisions, you can use the Watson Discovery pre-enriched news collection to keep track of various companies. With this code pattern as a guide, you can create a web app that lets you monitor, view sentiment information on, get links to news stories about, and track stock prices over time for companies you’re interested in investing in.

The code pattern explains how to create a Node.js web app that uses an open source bootstrap template from Blackrock Digital. The app uses Watson Discovery to gather information about the company and display an analysis of positive or negative sentiment. Price information comes from Alpha Vantage, and all of the information is stored in a Cloudant NoSQL database.

When you have completed this code pattern, you should understand how to:

  • Use Watson Discovery News
  • Create a Node.js app for a web interface to stock information
  • Access stock information from free APIs provided by Alpha Vantage
  • Store and retrieve information in a Cloudant NoSQL database

Flow

flow

  1. Add and remove stocks using the Web UI.
  2. The app processes the input and routes it to the back-end server.
  3. The back-end server stores the stock information in a Cloudant NoSQL database.
  4. The back-end server uses Watson Discovery to find information about a specific company.
  5. Watson Discovery queries the Watson News Collection for articles related to the company.
  6. The Alpha Vantage APIs are queried to find market price for a given company.
  7. News, sentiment, and stock price are all returned and rendered in the web app.

Instructions

Find the detailed steps for this pattern in the README. The steps will show you how to:

  1. Clone the watson-stock-advisor repo.
  2. Create IBM Cloud services.
  3. Configure Watson Discovery and get credentials.
  4. Provision a Cloudant NoSQL database and get credentials.
  5. Add IBM Cloud credentials to the .env file.
  6. Run the application.