I am trying to classify stock returns using an LSTM-based neural network.

I would like to use closing price and volume as features (see below), but am unsure of whether I need to transform these (e.g., by differencing) before feeding them into the network?

If anybody has done this sort of thing before and could give me some advice, or could refer me to any papers, I'd be very grateful.

closing price and volume



  • $\begingroup$ You say "classify"—into what classes? Buy or not? If so, it's often a good idea to standardize your data to have zero mean and unit variance before training to make data for different stocks comparable. See for example en.wikipedia.org/wiki/… $\endgroup$
    – hendrik
    Jul 11, 2019 at 12:45

1 Answer 1


Yes, you should calculate the log return for each stock, then feed them to the neural network.

I did a similar project before, but with only the close price, not the volume. I follow the method in this paper: Deep learning with long short-term memory networks for financial market predictions

Here's the code: https://github.com/tqa236/LSTM_algo_trading

Please take it with a grain of salt, the code quality is not very high. Also, the result is not quite impressive, both in my project and the original paper for these several recent years. We reach the same conclusion that it's really difficult to use vanilla LSTM to predict the stock market nowadays.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.