Skip to content

FinRL

Open-source Python framework for training and testing reinforcement learning agents on stock trading tasks.

Stars
17k
Forks
3.6k
Licence
MIT
Language
Jupyter Notebook
Last update
12 days ago
Type
Library

What it is

FinRL is a Python framework for applying deep reinforcement learning to financial trading. It provides market environments, learning agents, and a train-test-trade pipeline so users can simulate how an automated agent might make buy and sell decisions on historical stock data. The README describes it as an educational and research prototyping framework, and says a newer production-oriented project, FinRL-X, now exists for live trading.

  • Download DOW 30 stock data from Yahoo Finance and add technical indicators with the included example script
  • Train A2C, DDPG, PPO, TD3, and SAC agents on the training data using Stable Baselines 3
  • Backtest trained agents on 2026 trading data and compare them with MVO and the DJIA index
  • Inspect the generated backtest_result.png plot and printed performance results

Great for

  • Students learning how reinforcement learning is applied to financial markets
  • Researchers prototyping and benchmarking DRL trading agents
  • Developers who want a starting example of a train-test-backtest pipeline on DOW 30 stock data
  • Readers comparing trained agents against baselines such as MVO and the DJIA

Not ideal for

  • Anyone needing live trading or production deployment, because the README directs those users to FinRL-X / FinRL-Trading
  • Users seeking financial advice or guaranteed returns, since the README presents this as a research and education tool and does not claim profitability
  • Non-programmers, since setup and running scripts require Python and the command line
Step-by-step guide: how to use FinRLInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Python 3 (the README's Python badge shows 3.6, but the exact required version is not stated in the provided text) · git

    Clone the repository

    git clone https://github.com/AI4Finance-Foundation/FinRL.git

    Enter the folder

    cd FinRL

    Create and activate a virtual environment

    python3 -m venv venv && source venv/bin/activate

    Install FinRL in editable mode

    pip install -e .
  2. 2

    Run it

    • Run python examples/FinRL_StockTrading_2026_1_data.py to download and preprocess DOW 30 data
    • Run python examples/FinRL_StockTrading_2026_2_train.py to train the five DRL agents
    • Run python examples/FinRL_StockTrading_2026_3_Backtest.py to compare the agents against baselines and save backtest_result.png
  3. 3

    Get the most out of it

    • Read the README's FinRL-X vs. FinRL comparison to decide whether the classic or next-generation stack fits your goal
    • Use the train-test-trade pipeline structure as a template for your own datasets
    • Explore the finrl subfolders (applications, agents, meta) to see how environments and agents are organized
    • Watch the project's linked introductory video on the AI4Finance YouTube channel for an overview

Downloads

Strengths

  • Open source under the MIT license, so it can be used and modified freely
  • Includes a complete, runnable example from data download through backtesting
  • Supports several widely used DRL algorithms through Stable Baselines 3

Trade-offs

  • The README says this repository is for education and research, and the active production development has moved to FinRL-X
  • Requires familiarity with Python, virtual environments, and reinforcement learning concepts to use effectively
  • The README is truncated, so details on supported environments, versions, and data-source options beyond the example are unclear

How it compares

ProjectStarsTypeLevelUpdatedBest for
FinRL (this)17kLibraryintermediate12 days agoStudents learning how reinforcement learning is applied to financial markets
stable-baselines314kLibraryintermediate11 days agoResearchers who want a reliable baseline to compare a new method against
qlib49.9kLibraryadvanced7 days agoQuant researchers who want a structured ML workflow for stock data
machine-learning-for-trading21.7kLearning resourceintermediate7 days agoReaders of the Machine Learning for Trading book who want to run its code
vnpy46.2kFrameworkadvanced10 days agoPython developers who want to build custom quant trading systems
ML-From-Scratch33.3kLearning resourcebeginner3.1 years agoStudents who want to see how algorithms like regression or neural networks work internally

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.