Predicting stock price trend with Neural networks
- Get S&P 100 tickers ->
python download_data.py
- Make dataset ->
python make_data.py
- Remove NaN values from dataset ->
python remove_nan.py
- Handle imbance ->
python remove_imbalance.py
python trainconv.py
(manages to reach 99% accracy on test data)
python test.py
(backtest)
Trying to forcast stocks
Some problems faced:
- Stock price keeps increasing with time
- So much volatility
- Picking the right features
For problem 1, the solution I thought of was to predict the next close price relative to the previous n prices.
That still flunked tho.
For problem 3, After some data analysis, I found out that volume wasa negatively correlated to the stock price.
So, volume could be useful in predicting stock returns / prices
LSTM's and MLP's gave really poor results predicting the returns (prolly cos of the volatility)
I thought this would be significantly easier for the model.
It's phased as a classification problem
1 if up in the next n days else 0
the input the model is close and volume data from the past 16 days.
the time window for the close and volume is normalized between zero and one.
it is then reshaped to a (2,8) matrix
the close and volume is then combined to form two channels.
the input to the model is then of size (batch_size,2,2,8)
Even though it reaches 99% accuracy on test data, Backtesting the model on stock data from '2020-01-01' to '2021-06-30' (376 trading days) gives a 52% accuracy.