Skip to content

Arseni1919/gym-stocktrading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gym Env For Stock Trading

A custom OpenAI gym environment for simulating stock trades on historical price data with live rendering. In this project, we've implemented a simple, yet elegant visualization of the agent's trades using Matplotlib.

Great thanks to:

Installation

In order to run the environment you need to do the following:

  1. Copy the repo to your computer.
  2. Go to the one directory above of the copied repo on your computer in the Terminal. For example: cd PycharmProjects/.
  3. Run the command: pip install -e gym-stocktrading.

Make sure your pip is related to the relevant python environment (pipenv/conda/...) where gym package is located.

That's it! You've installed the new gym-env on your computer.

Sanity Check

In another project try to run the environment with this code:

import gym

env = gym.make('gym_stocktrading:stocktrading-v0')
ob = env.reset()
done = False

for i in range(100):
    while not done:
        action = env.action_space.sample()
        ob, reward, done, _ = env.step(action)
        env.render()
        if done:
            ob = env.reset()
            done = False

env.close()

Visualization

Snapshot Gif (in motion)

Enjoy!


Created by Neural Trading ©

About

Gym Env for stock trading

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages