Build a stock market predictor


In this code pattern, we’ll demonstrate how subject matter experts and data scientists can leverage IBM Watson Studio and Watson Machine Learning to automate data mining and the training of time series forecasters. This code pattern also applies Autoregressive Integrated Moving Average (ARIMA) algorithms and other advanced techniques to construct mathematical models capable of predicting trends based on data from the past.


Using IBM Watson Studio and Watson Machine Learning, this code pattern provides an example of data science workflow which attempts to predict the end-of-day value of S&P 500 stocks based on historical data. This pattern includes the data mining process that uses the Quandl API – a marketplace for financial, economic, and alternative data delivered in modern formats for today’s analysts.

After completing this code pattern, you’ll understand how to:

  • Use Jupyter Notebooks in Watson Studio to mine financial data using public APIs.
  • Use specialized Watson Studio tools like Data Refinery to prepare data for model training.
  • Build, train, and save a time series model from extracted data, using open-source Python libraries or the built-in graphical Modeler Flow in Watson Studio.
  • Interact with IBM Cloud Object Storage to store and access mined and modeled data.
  • Store a model created with Modeler Flow and interact with the Watson Machine Learning service using the Python API.
  • Generate graphical visualizations of time series data using Pandas and Bokeh.



  1. Create a Watson Studio project.
  2. Assign a Cloud Object Storage to the project.
  3. Load Jupyter notebook to Watson Studio.
  4. The sample data provided by Quandl API is imported by the notebook.
  5. Data imported is refined by Data Refinery and saved to Cloud Object Storage.
  6. Use SPSS modeler flow to create forecasts.
  7. Importing the Watson Machine Learning model exported from SPSS modeler flow to Watson Machine Learning.
  8. Exposing Watson Machine Learning model through an API.
  9. Application uses Watson Machine Learning API to create stock market predictions.


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

  1. Creating a new project in Watson Studio
  2. Mining data and making forecasts with a Python Notebook
  3. Configuring the Quandl API-KEY
  4. Configuring the IBM Cloud Object Storage credentials in the notebook
  5. Importing the mined data as an asset into the Watson Studio project
  6. Cleansing the data with Data Refinery
  7. Making forecasts with SPSS Modeler Flow
  8. Visualizing Modeler Flow results with a Python Notebook
  9. Deploying a Modeler Flow model in Watson Machine Learning