Neural-Net-with-Financial-Time-Series-Data is an open source software project using endogenous factors to predict daily log return of financial asset. The project includes serveral technical indicators (ie. Stochastics, Moving Average Convergence/Divergence oscillator) to train a LSTM neural network by stochastic gradient descent with warm restart(SGDR) and cosine annealing. This flexible architecture enables you to deploy with Nvidia CuDNN computation without rewriting code by yourself. Hyperparameters are fine-tuned by Bayesian search.
The current LSTM model result for predicting daily log return.
This old model uses LSTM to predict stock price.
This is the LSTM cell we used in the model.
It is faster than normal LSTM cell because of the implementation of CuDNN LSTM and batch normalization in the model.
26/03/2017 First update
- Recurrent neural network with LSTM is added to the code.
- Keras with tensorflow is also implemented.
- Tensorboard for neural network visualization is also added to the code.
14/04/2017 Second update
- Normalized adjusted close price.
- A new data downloader has been implemented for simplicity
- Added more variable to predict the adjusted close price
- More accurate result, significantly less mean square error
- Extra visualization for close price
- Denormalization will be fixed soon
- Twitter sentiment analysis is currently on testing stage
16/04/2017 Third update
- Updated denormalization
- More test results available
18/04/2017 Fourth update
- Updated fundamental data from Kaggle for NYSE
19/04/2017 Fifth update
- Supporting Python 3.5 on Windows 10
- Significant improvement in accuracy
29/04/2017 Sixth update
- ^GSPC Data since 1970 has been added, more training data, higher accuracy
- 7 years of test data
- Object oriented programming
- Hyperparameters for dropout has been tested
08/05/2017 Seventh update
- All Hyperparameters have been tested and results have been uploaded.
- Fixed comment for the data loader
- More technical analysis like volume, moving average and other indexes will be added
28/05/2017 Eighth update
- Using Quandl instead of Pandas datareader
- Correlation heatmap has been addded
- Using Adjusted OHLCV for the network
- All functions can be loaded from lstmstock.py
- A Quandl api key is provided temporarily for those who do not own a quandl account
- Moving averages have been added
02/10/2017 Nineth update
- Event driven analysis
- Switched to Tensorflow LSTM model
25/06/2018 Tenth update
- Complete rewrite of News downloader, removed Newsapi in order to get full access to NYTImes data for free
- Moving Average Convergence/Divergence oscillator (MACD), Stochastic Oscillator, Average True Range are added to train the model.
- log return is now used as target variable.
- Keras on top of Tensorflow is used.
- Randomized Search from SKLearn is used for optimization.
11/10/2018 Eleventh update Serveral state of the art techniques are applied
- CuDNN LSTM is used to accelerate training
- Stochastic gradient descent with warm restart
- Cosine annealing
- Use Bayesian search to optmize hyperparameters.
- New splitting method
- Dataset is provided
- HDF files are used to accelerate reading time
If you want to train your neural network on more data, feel free to load the data directly from Quandl. You should be able to get the historic price data of a particular stock after login. Use Export > Python > api key and insert the api key to your model. https://www.quandl.com/databases/WIKIP
Bernal, A., Fok, S., & Pidaparthi, R. (2012). Financial Market Time Series Prediction with Recurrent Neural Networks.
Box, G. E., Jenkins, G. M., Reinsel, G. C., & Ljung, G. M. (2015). Time series analysis: forecasting and control. John Wiley & Sons.
Gu, J., Wang, Z., Kuen, J., Ma, L., Shahroudy, A., Shuai, B., ... & Cai, J. (2015). Recent advances in convolutional neural networks. arXiv preprint arXiv:1512.07108.
Hutto, C.J. & Gilbert, E.E. (2014). VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text. Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.
Jaeger, H. (2001). The “echo state” approach to analysing and training recurrent neural networks-with an erratum note. Bonn, Germany: German National Research Center for Information Technology GMD Technical Report, 148(34), 13.
Jaeger, H. (2002). Tutorial on training recurrent neural networks, covering BPPT, RTRL, EKF and the" echo state network" approach (Vol. 5). GMD-Forschungszentrum Informationstechnik.
Maass, W., Natschläger, T., & Markram, H. (2002). Real-time computing without stable states: A new framework for neural computation based on perturbations. Neural computation, 14(11), 2531-2560.