Giter Club home page Giter Club logo

adriantorrie / dqn-ddpg_stock_trading Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ai4finance-foundation/finrl-tutorials

1.0 1.0 0.0 23.74 MB

Using DQN/DDPG for stock trading. Xiong, Z., Liu, X.Y., Zhong, S., Yang, H. and Walid, A., 2018. Practical deep reinforcement learning approach for stock trading, NeurIPS 2018 AI in Finance Workshop.

Home Page: http://www.tensorlet.com/

License: MIT License

Jupyter Notebook 24.73% Python 50.23% Dockerfile 0.03% HTML 25.01%

dqn-ddpg_stock_trading's Introduction

Practical Deep Reinforcement Learning Approach for Stock Trading

Prerequisites

Python 3.6 envrionment

CMake, OpenMPI

Installation of system packages CMake, OpenMPI on Mac

brew install cmake openmpi

Activate your envrionment using using conda or Anaconda

source activate myenv

Install gym under this environment

pip install gym

Download Official Baseline Package

  • Clone the repo and cd into it:

    git clone https://github.com/openai/baselines.git
    cd baselines
  • Install tendorflow

    pip install Tensorflow

    should be sufficient. Refer to TensorFlow installation guide for more details.

  • Install baselines package

    pip install -e .

Testing the installation

All unit tests in baselines can be run using pytest runner:

pip install pytest
pytest

Replace files with files in this repository and change file address

gym

Find your gym package under environment folder, in my computer it is under

/Users/xiongzhuoran/anaconda3/envs/venv/lib/python3.6/site-packages/gym/
  • Replece the file
gym\envs\__init__.py

with file from this repository

DQN_Stock_Trading/gym/envs/__init__.py 
  • Add folder in this repository to gym\envs in your computer
DQN_Stock_Trading/gym/envs/zxstock of this repository 
  • Open
gym/envs/zxstock/zxstock_env.py and gym/envs/zxstock/zxstock_testenv.py

change the address at line 9 and line 10 into where you want to save the image

Baseline

  • Open your baselines folder cloned before, find
baselines/baselines/run.py
  • Replace it with
DQN_Stock_Trading/baselines/baselines/run.py in this reposotory

Training model and Testing

If you only want to train the model run this

python -m baselines.run --alg=ddpg --env=ZXStock-v0 --network=mlp --num_timesteps=1e4

If you also want to see the testing result

python -m baselines.run --alg=ddpg --env=ZXStock-v0 --network=mlp --num_timesteps=1e4 --play

Some Other Commands May Need:

Tensorflow Update

pip install --upgrade tensorflow==1.11.0
pip3 install opencv-python
pip3 install lockfile
pip3 install -U numpy
pip3 install mujoco-py==0.5.7

Please cite the following paper

Xiong, Z., Liu, X.Y., Zhong, S., Yang, H. and Walid, A., 2018. Practical deep reinforcement learning approach for stock trading, NeurIPS 2018 AI in Finance Workshop.

dqn-ddpg_stock_trading's People

Contributors

bruceyanghy avatar yangletliu avatar yinchuanll avatar

Stargazers

Adrian Torrie avatar

Watchers

James Cloos 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.