Using LSTMs to Predict Stock Prices

preview_player
Показать описание
I walk through sample code that implements a Long Short-Term Memory (LSTM) model that predicts stock price movements, highlighting and discussing the important sections. I also talk about whether the model could be used to trade stocks profitably.

Disclaimer: This video is for educational purposes only. It doesn't constitute advice.
Рекомендации по теме
Комментарии
Автор

Congratulations for being very clear in your explanations and very honest in the model evaluation.

HiltonFernandes
Автор

This is amazing, im just starting out with testing my own model and your points are clarifying, would love more videos on this

trhtkify
Автор

Stumbled upon your video today after learning about backpropagation. Really appreciate the clarity in your presentation and being honest about the model's results. Sadly, 53% success rate is no better than flipping a coin. Another factor that lead to many fund managers giving up on Machine Learning in recent years is market reflexivity. Quants are able to predict with high probability using an ensemble of algos but once they place a trade, the prediction goes haywire, due to the trade meddling with the chart pattern. Stock Price prediction is possibly the only ML endeavour that the analyst "poisons" the data after acting on it. Weather prediction on the other hand, a time series I believe where LSTM is deployed, successfully makes predictions because meteorologists are simply observing the atmosphere. Still early days, but I have seen publishings about success predicting an Emerging Market: Vietnam, claiming that it was achieved through multiple inputs from Closing Price to Technical Indicators. No evidence of people profiting from it so it seems like just theory at this point in time... like you mentioned, these papers are meant to make the PhDs look good.

sweealamak
Автор

I really enjoyed the clarity in your video. It would be interesting to see how this model performs with dollar bars. I am new to this area and have been reading time bar sampling has inherent limitations. Thank you for sharing your code, I'd like to dig deeper and this helps tremendously.

paulrelf
Автор

Hi thanks for the tutorial very useful! I think all are waiting for the version with multiple stock

raphamejias
Автор

I wonder if you chose stocks for your model that didn't have many or few options contracts if it would remove some of the randomness.

dennisdmenace
Автор

The videos you produce are super helpful for me, since I am working hard on understanding the math and logic behind neural networks. When you were talking about it not being suitable for predicting just the next it got me thinking. You could try and predict the price tomorrow and the day after with the same input data. If the price is down tomorrow you do an close market order otherwise you could buy at market open. I am curious what you would think of such trading strategy and maybe issues that arise like for example it being harder to train maybe? Also won't this model perform much better if you were to add loads of extra data like indicators and such. I am so happy I found you, you are super helpful on this journey with your videos!

PolarTheIcebear-xlts
Автор

would using a transformer based model be better? would love a video on that topic

devanshkm
Автор

Hey Jin, do you think transformers can do a better job than LSTM on stock prediction

doords
Автор

Torch 2.0 isn't available anymore and changing it to torch 2.2 causes the program to crash.

dennisdmenace
Автор

Great video! I appreciate how you delve into various aspects, unlike other videos that skim over crucial details. One aspect that caught my attention is the delay in prediction. Correct me if I'm wrong, but you utilize a sequence of returns up until a certain date, let's say February 16th in your example, to forecast the return on February 18th (calculated as the closing price on the 18th minus the closing price on the 17th, divided by the closing price on the 17th).

My concern is practicality. If the model predicts a +10% return, does it mean one should buy the stock at the closing price on the 17th? But is it feasible to execute a trade at the exact closing price on the 17th? I'm curious about how this works in real trading scenarios.

larryvanwallendael
Автор

This is an extremely useful tutorial; very clear and info-rich. Two questions: The two-week time-sequences you use seem to all be the same length. Could you please share any thoughts that you may have on: a) using varying-length time-sequences, ie different history lengths and b) using time-sequences w/ varying history lengths initially, but that are subsequently padded with zeros so that we end up with the same fixed history length across all time-sequences?

christosmaroulis
Автор

Really very practical. A lot of people try to predict price instead of return which might appear to give results but is an illusion and is not what we trade on. It sounds like you are not a big believer in the utility of these models but I am curious as to how well they might do at predicting return over a week or a month. It seems counterintuitive that they would be more successful at this but then if looking for patterns that might work and in some ways looking over a time period might actually eliminate some of the noise. In addition I am thinking some of the other potential inputs like sentiment, interest rate future prices, equity option prices might then have more relevance as inputs. Thoughts?

christopherrose
Автор

Could you please make a follow-up video or reference materials where you trained an LSTM using multiple stocks?

christosmaroulis
Автор

Can you predict the low and high of the next day?

thoainguyen-su
Автор

Could a mixture of experts be used with multiple lstms as experts for better results?

kolly