stock_market_reinforcement_learning-master
所属分类:其他
开发工具:Python
文件大小:375KB
下载次数:13
上传日期:2019-07-03 18:37:04
上 传 者:
XJN
说明: 神经网络强化学习用于量化交易,供参考,谢谢
(stock_market_reinforcement_learning-master.zip,thanks)
文件列表:
kospi_10.csv (204, 2016-12-23)
market_dqn.py (4716, 2016-12-23)
market_env.py (5060, 2016-12-23)
market_model_builder.py (3329, 2016-12-23)
market_pg.py (4813, 2016-12-23)
model_builder.py (687, 2016-12-23)
pg_over_top_10.png (14800, 2016-12-23)
sample_data (0, 2016-12-23)
sample_data\000660.csv (172130, 2016-12-23)
sample_data\005380.csv (178627, 2016-12-23)
sample_data\005930.csv (188535, 2016-12-23)
sample_data\005935.csv (182329, 2016-12-23)
sample_data\012330.csv (177509, 2016-12-23)
sample_data\015760.csv (172568, 2016-12-23)
sample_data\028260.csv (23544, 2016-12-23)
sample_data\032830.csv (82623, 2016-12-23)
sample_data\035420.csv (103260, 2016-12-23)
sample_data\090430.csv (130606, 2016-12-23)
# Stock Trading Market OpenAI Gym Environment with Deep Reinforcement Learning using Keras
## Overview
This project provides a general environment for stock market trading simulation using [OpenAI Gym](https://gym.openai.com/).
Training data is a close price of each day, which is downloaded from Google Finance, but you can apply any data if you want.
Also, it contains simple Deep Q-learning and Policy Gradient from [Karpathy's post](http://karpathy.github.io/2016/05/31/rl/).
In fact, the purpose of this project is not only providing a best RL solution for stock trading, but also building a general open environment for further research.
**So, please, manipulate the model architecture and features to get your own better solution.**
## Requirements
- Python2.7 or higher
- Numpy
- HDF5
- Keras with Beckend (Theano or/and Tensorflow)
- OpenAI Gym
## Usage
Note that the most sample training data in this repo is Korean stock.
You may need to re-download your own training data to fit your purpose.
After meet those requirements in above, you can begin the training both algorithms, Deep Q-learning and Policy Gradient.
Train Deep Q-learning:
$ python market_dqn.py [model filename]
Train Policy Gradient:
$ python market_pg.py [model filename]
For example, you can do like this:
$ python market_pg.py ./kospi_10.csv pg.h5
Aware that the provided neural network architecture in this repo is too small to learn.
So, it may under-fitting if you try to learn every stock data.
It just fitted for 10 to 100 stock data for a few years. (I checked!!)
Thus you need to re-design your own architecture and
**let me know if you have better one!**
Below is training curve for Top-10 KOSPI stock datas for 4 years using Policy Gradient.
![Training Curve](./pg_over_top_10.png)
## To do
- Test environment to check overfitting.
- Elaborate the PG's train interface.
## Reference
[1] [Playing Atari with Deep Reinforcement Learning](http://arxiv.org/abs/1312.5602)
[2] [Deep Reinforcement Learning: Pong from Pixels](http://karpathy.github.io/2016/05/31/rl/)
[3] [KEras Reinforcement Learning gYM agents, KeRLym](https://github.com/osh/kerlym)
[4] [Keras plays catch, a single file Reinforcement Learning example](http://edersantana.github.io/articles/keras_rl/)
近期下载者:
相关文件:
收藏者: