whatisgithub

What is rl-stock?

wangshub/rl-stock — explained in plain English

Analysis updated 2026-05-18

3,655Jupyter NotebookAudience · researcherComplexity · 3/5Setup · moderate

In one sentence

RL-Stock is a research project testing whether deep reinforcement learning can learn profitable stock trading strategies.

Mindmap

mindmap
  root((RL-Stock))
    What it does
      Simulates stock trading
      Trains AI agent
      Reports profit results
    Tech stack
      Python
      OpenAI Gym
      PPO
    Use cases
      Study reinforcement learning
      Backtest trading strategies
      Learn algorithmic trading
    Audience
      Researchers
      Data scientists

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Study how reinforcement learning can be applied to stock trading decisions

USE CASE 2

Backtest a PPO trading agent against 20+ years of Chinese stock data

USE CASE 3

Learn how to build a custom OpenAI Gym trading environment

What is it built with?

PythonOpenAI GymPPOJupyter Notebook

How does it compare?

wangshub/rl-stockchiphuyen/python-is-coolfacebookresearch/laser
Stars3,6553,6593,661
LanguageJupyter NotebookJupyter NotebookJupyter Notebook
Setup difficultymoderateeasymoderate
Complexity3/52/53/5
Audienceresearcherdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1h+

README is in Chinese, results are experimental, not financial advice.

So what is it?

RL-Stock is a research project that explores whether a type of artificial intelligence called deep reinforcement learning can be trained to trade stocks automatically and profitably. The README is written in Chinese and describes an experiment created after the author suffered losses in the Chinese stock market during the COVID-19 period. Reinforcement learning works by having an AI agent take actions (in this case: buy, sell, or hold a stock) and receive rewards or penalties based on the outcome. Over many simulated trading sessions, the agent gradually learns which actions lead to profit. This is different from approaches that simply predict whether a stock price will go up or down, here the agent decides a full sequence of trading actions to maximize total return. The project builds a simulated stock trading environment using OpenAI Gym, a standard framework for reinforcement learning experiments. The agent observes daily market data for a stock: opening price, closing price, high, low, trading volume, price-to-earnings ratio, and similar figures. Based on those inputs it decides how much of the stock to buy or sell that day. If the agent ends a session with more money than it started with, it gets a positive reward, losses give it a large penalty (-100) to discourage losing trades. The AI model used is PPO (Proximal Policy Optimization), a well-regarded algorithm from OpenAI that works well when actions are continuous values rather than simple yes/no choices. Historical stock data comes from baostock, a free Chinese securities data platform. The dataset covers over 20 years of data for Shanghai-listed stocks, split into a training portion and a one-month test period. The reported results across 1,002 Chinese stocks show the strategy produced profit on 44.5% of stocks, broke even on 46.5%, and lost money on 9%. The author notes the approach is experimental, meant as a learning exercise rather than financial advice, and cannot guarantee real-world effectiveness.

Copy-paste prompts

Prompt 1
Help me set up the RL-Stock environment and train the PPO trading agent
Prompt 2
Explain how the reward and penalty system works in this trading simulation
Prompt 3
Show me how to change the stock dataset used for training
Prompt 4
Walk me through interpreting the profit and loss results from a test run

Frequently asked questions

What is rl-stock?

RL-Stock is a research project testing whether deep reinforcement learning can learn profitable stock trading strategies.

What language is rl-stock written in?

Mainly Jupyter Notebook. The stack also includes Python, OpenAI Gym, PPO.

How hard is rl-stock to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is rl-stock for?

Mainly researcher.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.