← all repositories
lilianweng/stock-rnn

A stock predictor that admits it’s really a TensorFlow demo

Built to teach RNN mechanics in TensorFlow, using stock prices as a conveniently noisy dataset.

2k stars Python Domain AppsML Frameworks
stock-rnn
Not currently ranked — collecting fresh signals.
star history

What it does

Trains a recurrent neural network with multilayer LSTM cells on historical S&P 500 data to predict future prices. You can feed it a single index or mix in many individual stocks, optionally learning an embedding layer across them. The author is explicit that the goal is demonstrating TensorFlow training patterns, not solving finance.

The interesting bit

The unusual honesty is the feature. Most “predict stocks with AI” repos pretend they’ve cracked the market; this one openly labels itself a tutorial reference point and invites improvements. The optional multi-stock embedding is a nice architectural touch for learning shared representations across tickers.

Key highlights

  • Multilayer LSTM built in TensorFlow 1.x with command-line training controls
  • Optional embedding layer when training across multiple stocks
  • Fetches historical data from Yahoo/Google Finance APIs (with a 4,000-day ceiling noted)
  • Ships with a pre-crawled data archive through July 2017
  • Accompanied by a detailed two-part blog walkthrough

Caveats

  • The README explicitly warns not to expect strong prediction outcomes; it is a demo, not a trading strategy
  • Environment is pinned to Python 2.7 and TensorFlow 1.2.1, making it a period piece for modern workflows
  • The bundled data archive and fetcher targets stop in mid-2017

Verdict

Worth a look if you want a clean, self-contained example of LSTM construction in older TensorFlow or need a starting point for time-series embedding experiments. Skip it if you are hunting for an edge in algorithmic trading—the README already beat you to that warning.

Frequently asked

What is lilianweng/stock-rnn?
Built to teach RNN mechanics in TensorFlow, using stock prices as a conveniently noisy dataset.
Is stock-rnn open source?
Yes — lilianweng/stock-rnn is an open-source project tracked on heatdrop.
What language is stock-rnn written in?
lilianweng/stock-rnn is primarily written in Python.
How popular is stock-rnn?
lilianweng/stock-rnn has 2k stars on GitHub.
Where can I find stock-rnn?
lilianweng/stock-rnn is on GitHub at https://github.com/lilianweng/stock-rnn.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.