https://github.com/x4nth055/price-prediction
Predicting different market prices using Deep Learning and Recurrent Neural Networks
https://github.com/x4nth055/price-prediction
cryptocurrency-price-predictor deep-learning market-price-prediction neural-networks price-prediction python3 recurrent-neural-networks stock-price-prediction
Last synced: 5 months ago
JSON representation
Predicting different market prices using Deep Learning and Recurrent Neural Networks
- Host: GitHub
- URL: https://github.com/x4nth055/price-prediction
- Owner: x4nth055
- License: mit
- Created: 2019-05-21T18:16:56.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-24T23:42:01.000Z (over 2 years ago)
- Last Synced: 2025-04-19T07:46:57.898Z (6 months ago)
- Topics: cryptocurrency-price-predictor, deep-learning, market-price-prediction, neural-networks, price-prediction, python3, recurrent-neural-networks, stock-price-prediction
- Language: Python
- Size: 14.5 MB
- Stars: 38
- Watchers: 2
- Forks: 23
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Price Prediction using Deep Learning
## Introduction
This repository uses recurrent neural networks to predict the price of any stock, currency or cryptocurrency ( any market that [yahoo_fin](http://theautomatic.net/yahoo_fin-documentation/) library supports ) using **keras** library.## Getting Started
to use this repository, install required packages
1. Python 3.6
2. keras==2.2.4
3. sklearn==0.20.2
4. numpy==1.16.2
5. pandas==0.23.4
6. matplotlib==2.2.3
7. yahoo_finusing the following command:
```
pip3 install -r requirements.txt
```
## Dataset
Dataset is downloaded automatically using [yahoo_fin](http://theautomatic.net/yahoo_fin-documentation/) package and stored in `data` folder. click [here](http://theautomatic.net/yahoo_fin-documentation/) for more information about different tickers.
### **Example**
```python
from keras.layers import GRU, LSTM, CuDNNLSTM
from price_prediction import PricePredictionticker = "BTC-USD"
# init class, choose as much parameters as you want, check its docstring
p = PricePrediction("BTC-USD", epochs=1000, cell=LSTM, n_layers=3, units=256, loss="mae", optimizer="adam")# train the model if not trained yet
p.train()
# predict the next price for BTC
print(f"The next predicted price for {ticker} is {p.predict()}$")
# decision to make ( sell/buy )
buy_sell = p.predict(classify=True)
print(f"you should {'sell' if buy_sell == 0 else 'buy'}.")
# print some metrics
print("Mean Absolute Error:", p.get_MAE())
print("Mean Squared Error:", p.get_MSE())
print(f"Accuracy: {p.get_accuracy()*100:.3f}%")
# plot actual prices vs predicted prices
p.plot_test_set()
```
### Output
```
The next predicted price for BTC-USD is 8011.0634765625$
you should buy.
Mean Absolute Error: 145.36850360261292
Mean Squared Error: 40611.868264624296
Accuracy: 63.655%
```Training logs are stored in `logs` folder that can be opened using [tensorboard](https://github.com/tensorflow/tensorboard), as well as model weights in `results` folder.
## Next Steps
- Fine tune model parameters ( `n_layers`, RNN `cell`, number of `units`, etc.)
- Tune training parameters ( `batch_size`, `optimizer`, etc. )
- Try out different markets such as *NFLX (Netflix)*, *AAPL (Apple)* by setting the `ticker` parameter