Python 3.6 envrionment
Installation of system packages CMake, OpenMPI on Mac
brew install cmake openmpi
source activate myenv
pip install gym
-
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 .
All unit tests in baselines can be run using pytest runner:
pip install pytest
pytest
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
- Open your baselines folder cloned before, find
baselines/baselines/run.py
- Replace it with
DQN_Stock_Trading/baselines/baselines/run.py in this reposotory
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
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
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.