Skip to content

WenlinMao/TradingViaRL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stock Trading with Gym Environment

A custom OpenAI gym environment for simulating stock trades on historical price data.

Installation of Stable_Baselines

Prerequisites

Baselines requires python3 (>=3.5) with the development headers. You'll also need system packages CMake, OpenMPI and zlib. Those can be installed as follows

Mac OS X

Installation of system packages on Mac requires Homebrew. With Homebrew installed, run the follwing:

brew install cmake openmpi

Install using pip

Install the Stable Baselines package

Using pip from pypi:

pip install stable-baselines

Please read the documentation for more details and alternatives (from source, using docker).

Installation of mpl_finance

Install the mpl_finance package for plotting

Using pip from pypi:

pip install mpl_finance

How to run

Get historical data

To get historical stock price data from Alpha Vantage, run the following code:

python fetchdata.py

Run the algorithm

You can either render the result to a text file or visualize it

python main.py

Check the parameter of the render function for usage.

References

If you'd like to learn about creating custom OpenAI gym environments, check out the Medium article

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages