Machine Learning with Financial Time Series Data

This solution presents an example of using machine learning with financial time series on Google Cloud Platform.

Time series are an essential part of financial analysis. Today, you have more data at your disposal than ever, more sources of data, and more frequent delivery of that data. New sources include new exchanges, social media outlets, and news sources. The frequency of delivery has increased from tens of messages per second 10 years ago, to hundreds of thousands of messages per second today. Naturally, more and different analysis techniques are being brought to bear as a result. Most of the modern analysis techniques aren't different in the sense of being new, and they all have their basis in statistics, but their applicability has closely followed the amount of computing power available. The growth in available computing power is faster than the growth in time series volumes, so it is now possible to analyze large scale time series in ways that weren't previously practical.

In particular, machine learning techniques, especially deep learning, hold great promise for time series analysis. As time series become more dense and begin to overlap, machine learning offers a way to separate the signal from the noise. Deep learning holds potential because it is often the best fit for the seemingly random nature of financial time series.

This solution uses public data from Quandl.


  • Obtain data for a number of financial markets.
  • Munge that data into a usable format and perform exploratory data analysis in order to explore and validate a premise.
  • Use TensorFlow to build, train and evaluate a number of models for predicting what will happen in financial markets.


See Cloud Datalab Pricing to understand Cloud Datalab costs.

This tutorial uses Google BigQuery and Google Cloud Storage, which might add to costs.

Before you begin

Deploy and sign into Cloud Datalab. Follow the steps in the Cloud Datalab Quickstart.

Using the tutorial

The tutorial runs in a Cloud Datalab notebook. Cloud Datalab is built on Jupyter notebooks. With Cloud Datalab, you can analyze data in Google BigQuery and Google Cloud Storage by using Python and SQL.

Using the notebook

The notebook is a pre-installed sample that is included in the Cloud Datalab distribution. To view the notebook:

  1. Using the local Cloud Datalab page in your browser, go to the datalab/docs/samples/TensorFlow folder. For example, a local Datalab URL for the folder is localhost:8081/tree/datalab/docs/samples/TensorFlow.
  2. Open the notebook named Machine Learning with Financial Data.ipynb.
  3. Follow the steps in the notebook.

When you follow along with the tutorial, you can run individual cells as you go, or run all the cells first and then read through the tutorial.

What's next