Giter Club home page Giter Club logo

deep-reinforcement-learning-stock-trader's Introduction

Stock Trading OpenAI Gym Environment with Deep Reinforcement Learning

Overview

This project provides a general environment for stock market trading simulation using OpenAI Gym. 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.

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.

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 from Chinese stocks. You need to re-download your own training data depending on your problem.

If all the above requirements are satisfied you can begin training both the algorithms, Deep Q-learning and Policy Gradient.

Train Deep Q-learning:

$ python market_dqn.py <list filename> [model filename]

Train Policy Gradient:

$ python market_pg.py <list filename> [model filename]

For example, you can do:

$ python market_pg.py ./kospi_10.csv pg.h5

Please note that the provided neural network architecture in this repo is too small to learn. So, it may under-fit if you try to learn al stock data. It's just fitted for 10-100 stocks worth of data for a few years.This was the first project before I worked on the propreitary version for the fund I'm working with.
Thus you need to re-design your own architecture! Have fun with this one, and
let me know if you have better one!

Below is training curve for Top-10 SSE stock datas for 4 years using Policy Gradient. Clearly you need to train more!! Training Curve

To do

  • Test environment to check overfitting.
  • Elaborate the PG's train interface.

Reference

[1] Playing Atari with Deep Reinforcement Learning
[2] Deep Reinforcement Learning: Pong from Pixels
[3] Keras Reinforcement Learning gYM agents, KeRLym
[4] Keras plays catch, a single file Reinforcement Learning example

deep-reinforcement-learning-stock-trader's People

Contributors

accomplishedcode avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.