rltrader: a book companion repository with six backends and one schema marked TBD
Deep learning and reinforcement learning stock trading with Python and Keras - an introduction to state-of-the-art solutions for quant investing and algorithmic trading (revised edition).
At a glance
- What is it?
- rltrader is Quantylab's reinforcement learning stock trading code, published as the companion repository for a revised book and wired for six different backend environments, and its documentation says more about CUDA versions and error messages than about the trading logic itself.
- Who is it for?
- rltrader fits someone following the Quantylab book who already has the training data and is willing to match a CUDA and cuDNN pair to the backend they want, since what the repository offers is the code the book walks through rather than a maintained library. It fits badly as an install-and-go project.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 79 days ago.
- What is it written in?
- Mainly Jupyter Notebook, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 11, 2026, and from our analysis. They are not legal advice.
Editorial analysis
Four backends, six requirements files, and a CUDA pair for each
The repository is prepared for several deep learning stacks at once, and the top level shows it in the file names: requirements_common.txt, requirements_plaidml.txt, requirements_pytorch.txt, requirements_tf1_cpu.txt, requirements_tf1_gpu.txt and requirements_tf2.txt, plus four Windows launchers, run.cmd, run_e2_plaidml.cmd, run_e2_tf_gpu.cmd and run_e3.cmd. Each stack is pinned to its own accelerator stack. TensorFlow 1.15 wants Python 3.6, CUDA 10.0 and cuDNN 7.3.1:
conda create -n rltrader python=3.6
conda activate rltrader
pip install tensorflow-gpu==1.15
conda install cudatoolkit=10.0
conda install cudnn=7.3.1
pip install numpy
pip install pandasTensorFlow 2.5 moves to CUDA 11.2 and cuDNN 8.1, plus two Windows PATH entries for the CUDA toolkit, and PyTorch is installed through its own channel:
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorchThree different CUDA generations for one codebase is the price of covering TensorFlow 1.x, TensorFlow 2.x, PyTorch and PlaidML.
The Python floor is stated twice and the two statements disagree
One section asks for Anaconda 3.7 or newer, and the next asks for Python 3.6 or newer, with no note reconciling them. The development environment block then names PyTorch 1.10.1, TensorFlow 2.7.0 and Keras 2.7.0, noting that Keras ships inside TensorFlow, and the setup instructions pin TensorFlow to 2.7.0 and offer PlaidML as `pip install plaidml-keras==0.7.0` alongside mplfinance for charting. The conda walkthroughs underneath are older than that block, since they still create environments for TensorFlow 1.15 and 2.5. In practice that means the file a newcomer reads first describes a newer stack than the commands that follow it, and the version to trust is the one in the environment block rather than the one in the install section.
One command trains, and it takes a stock code and a date range
The whole system is driven from the command line through `main.py`, with `run_e3.cmd` given as the reference for how that looks on Windows, and the documentation also notes that the modules can be imported directly instead. The training invocation passes everything as flags:
python main.py --mode train --ver v3 --name 005930 --stock_code 005930 --rl_method a2c --net dnn --start_date 20180101 --end_date 20191231Read left to right, that is a mode of train, a data version of v3, a run name that repeats the stock code, an reinforcement learning method of a2c, a network type of dnn, and a date range covering 2018 to 2019. The stock code is a Korean market code in this example. The presence of `--ver` in the training command rather than only in a config file is worth noting, because it means the same invocation can be repeated against v1 through v4 data with one flag changed, which is how the data versions are meant to be compared. The presence of `--mode train` implies modes the documentation does not enumerate, and the four launchers named after experiment numbers pair with the four backends, so the Windows path is a choice of script rather than a flag.
The training data is downloaded from a cafe, not from the repository
Nothing about the dataset ships with the code. The instructions point at the Quantylab Naver cafe and tell you to find the RLTrader training data menu there, which makes an external account a prerequisite for running anything. Four data versions exist, v1 through v4, and the documentation recommends v3 or v4. The distinction between them is about market context: v3 adds some important market data on top of the per-stock data, and v4 adds market data to v3 in bulk. For v3 and v4 the two are meant to be used together, stock data combined with market data, and `data_manager.py` is pointed at as the place where that combination happens. The repository itself contains a `data/` directory, a `models/` directory and a `notebooks/` directory for experimentation, so the working directories exist even though the dataset behind them does not, and an `img/` directory of figures sits at the top level as the only other content.
The v4 market data column list is literally TBD
The stock-level schema is documented in full, and it is where the modelling assumptions are visible. The v3 stock data runs from the usual open, high, low, close and volume through valuation and profitability fields, PER, PBR and ROE, a set of ratio columns comparing price and volume to their moving averages at 5, 10, 20, 60 and 120 periods, and separate blocks of institutional and foreign investor columns with their own differences and moving averages. The market-level v3 schema is shorter and indexes the KOSPI index and the three-year Korean bond yield against their own moving averages. The v4 section says its stock data is identical to v3 and that its market data adds further columns, and then lists those added columns as TBD. So the newest dataset version is the one whose feature set cannot be read from the documentation.
Two documented failures come with pinned fixes
The troubleshooting section names two errors precisely, which is more useful than most of the rest of the file. The first is `NotImplementedError: Cannot convert a symbolic Tensor (lstm/strided_slice:0) to a numpy array.` under TensorFlow 1.15, and the fix given is to line the interpreter up with that expectation by using Python 3.6. The second is an AttributeError on `original_keras_version`, where a string is decoded as if it were bytes, and the answer is a version pin rather than a code change:
pip install h5py==2.10.0with links to a Keras issue and to the h5py release history for the reasoning. Profiling is documented alongside them:
python -m cProfile -o profile.pstats main.py ...
python profile.pyOne catch: the repository contains `profile_printer.py` and not `profile.py`, so the second profiling command as written has no matching file.
The repository exists to accompany a paid book
The README is written as book support material. It opens by describing reinforcement learning as a self-learning technique suited to stock data, then explains that the book teaches building a stock investment simulation with reinforcement learning in Python, with detailed notes at both the theory and code level, and lists what is covered: deep learning and reinforcement learning theory, applying it to stock investing, building the system, acquiring and processing real stock data, training on it, using the trained model, and customising the system. It is the revised second edition, and it is sold through Korean online bookstores, which the README links to at the top. The repository supplies the code that the book walks through, which is why the documentation concentrates on reproducing an environment rather than on API design, and why the author and publisher point at their own site rather than at package documentation.
Three version numbers point in three directions
The packaging and the tag history disagree, and so does the repository activity. `setup.py` declares version 3.0 for the package `rltrader`, described as Quantylab reinforcement learning for stock trading, and installs only the `quantylab` namespace package, found with a namespace package search restricted to that prefix. The tagged releases stop much earlier: v2.0-alpha in March 2020, v2.0.1-alpha in April 2020, and v2.1 in September 2021. The branch itself was last pushed on 25 July 2026. The practical reading is that the code has moved well past the last tag, so pinning to a release tag gives you an older codebase than the branch, and the version inside setup.py is the only number the project bumps deliberately. Anything expecting a current release to install from should look at the branch instead.
Editorial conclusion
rltrader fits someone following the Quantylab book who already has the training data and is willing to match a CUDA and cuDNN pair to the backend they want, since what the repository offers is the code the book walks through rather than a maintained library. It fits badly as an install-and-go project. Three things to know first. The Python floor is stated twice and the two statements disagree, with Anaconda 3.7 or newer in the environment section and Python 3.6 or newer in the development section, while the environment block names TensorFlow 2.7.0 and PyTorch 1.10.1 and the conda instructions still install TensorFlow 1.15 or 2.5. The training data is not in the repository, it comes from a Naver cafe, and the v4 market data schema is listed as TBD. And the version numbers disagree in three directions, with setup.py at 3.0, the newest tag v2.1 dated September 2021, and the branch last pushed on 25 July 2026. MIT licensed.
Frequently asked questions
What is rltrader?
Reinforcement learning stock trading code in Python from Quantylab, published as the companion repository for a revised second edition book on deep learning and reinforcement learning for algorithmic trading. TensorFlow, PyTorch and PlaidML backends sit behind a single main.py entry point.
What data does rltrader train on?
Stock-level fields such as open, high, low, close, volume, PER, PBR and ROE, ratio columns comparing price and volume to moving averages, and institutional and foreign investor columns, combined with market-level data holding KOSPI and three-year bond moving-average ratios. Four data versions exist and v3 or v4 are the ones recommended.
Do I need a GPU to run rltrader?
The documented environments pair each backend with its own accelerator stack: TensorFlow 1.15 with CUDA 10.0 and cuDNN 7.3.1, TensorFlow 2.5 with CUDA 11.2 and cuDNN 8.1, and PyTorch installed with cudatoolkit=10.2. There are also CPU requirement files for the TensorFlow 1.x path.
Where do I get the rltrader training data?
Not from the repository. The documentation points to the Quantylab Naver cafe and its RLTrader training data menu, where four versions are available. The repository holds the code, model, notebook and data directories, but the dataset itself is distributed separately.
What version of rltrader is current?
The packaging declares version 3.0 in setup.py, while the newest GitHub release is v2.1 from September 2021, after v2.0-alpha and v2.0.1-alpha in 2020. The default branch was last pushed on 25 July 2026, so the branch is ahead of any tag.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/quantylab-rltrader)