jinglescode / time-series-forecasting-pytorch

Acquiring data from Alpha Vantage and predicting stock prices with PyTorch's LSTM
https://www.alphavantage.co/academy/#lstm-for-finance
Apache License 2.0
203 stars 84 forks source link

Predicted price is far different from actual price #7

Open markcomfresh opened 2 years ago

markcomfresh commented 2 years ago

Hi Hong,

I tried the project with IBM, the result is amazing. However, when I tried with other stock, e.g. AAPL, the predict price is much lower than actual price. What would I do to make the predict price is closer to actual price? what line of code should I take a look at to make the adjustment?

Thank you, Mark

jinglescode commented 2 years ago

Hi @markcomfresh, a few things I would try and check are:

Tonkyboy commented 2 years ago

Hey Jingles,

at first, nice work!

I tested out on a lot of stocks, and I am facing the same difference as markcomfresh does. But I also see the reason why, cause if I check the plot for training and validation it's the most time, that the training datas are from the time before the "massive overvalued bull run" began in stock market, and the most validation datas are from the "massive overvalued bull run".

I found out how to change the time range of the training data, but didn't find to mix them up or cut them in smaller slices. So the model also includes some validation datas before run up and some training datas from run up.

Would be really happy if you could help me to find a way to split this a bit more.

Regards Alex

cdiener1 commented 2 years ago

That's what I thought was possibly happening! How can I separate out my training and validation like that? I want to have an ai for the SP 500 so I am trying it on SPY and it is half the price it should be. Also, is there a way to download the trained model so I don't need to go through the epochs each time? Can I then just have python pull up the trained file and run it? How can I add more data to the model such as RSI, Inflation, and so on? Figure_1 Figure_2 Figure_3

cdiener1 commented 2 years ago

Also, what does it hurt to add more layers and epochs? Is overfitting the greatest danger?