Skip to content
All library documents

Preparing Return Sequences for TensorFlow LSTM Stock Forecasting

Article BigQuant

Summary

This tutorial outlines a TensorFlow LSTM workflow for forecasting stock or index returns. It recommends transforming closing prices into returns, then arranging recent observations into sequential input groups with the next observations as prediction labels. It explains how the resulting samples map to recurrent-network input and output tensors, and describes chronological training and test sets intended to keep evaluation data separate from training data.

The tutorial introduces TensorFlow components for single-layer and stacked LSTMs, dropout, and recurrent computation, then describes a predictor class with training, testing, and prediction methods. It says the approach is demonstrated on the Shanghai Composite, but provides no performance figures or detailed results in the supplied text. The guide is primarily an implementation outline; it does not establish predictive or trading profitability. Its discussion of bounded returns relies on market limits and activation ranges, so the preprocessing assumptions may not apply across instruments or markets.

Key ideas

  • The tutorial converts closing prices into returns before using them as model inputs.
  • It groups past returns into sequences and labels each sample with subsequent returns.
  • The described TensorFlow tensors represent batches of sequences and predicted outputs.
  • It introduces LSTM, dropout, and stacked recurrent-network components for the forecasting workflow.
  • The text mentions a Shanghai Composite demonstration but provides no performance evidence.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.