Repolode
AI4Finance-Foundation

AI4Finance-Foundation/FinRL

An open-source Python framework for applying deep reinforcement learning to automated stock trading and portfolio tasks.

Stars
16,757
Forks
3,569
Open issues
308
Last commit
8 hours ago

What is it?

FinRL is a Python framework for building financial reinforcement learning trading agents. It organizes work into three layers: market environments that simulate trading tasks, DRL agents that learn decision-making policies, and financial applications such as stock trading and portfolio allocation. An agent interacts with a market environment and learns a policy through train, test and trade stages.

The framework includes DRL algorithms such as A2C, DDPG, PPO, TD3 and SAC via Stable Baselines 3, and it supports multiple data sources, including Yahoo Finance, Alpaca, Binance, CCXT and Tushare. Built-in preprocessing adds technical indicators such as MACD and RSI, along with VIX and turbulence index features. The example scripts train agents on DOW 30 stock data and compare backtest results against baselines such as Mean Variance Optimization and the DJIA index.

This repository is the original, classic FinRL workflow aimed at education, experimentation and research prototyping. The maintainers point users to the separate FinRL-X / FinRL-Trading project for production-oriented trading systems. The code is released under the MIT license and is provided for academic purposes, not as financial advice.

Key features

  • 01Implements DRL agents such as A2C, DDPG, PPO, TD3 and SAC
  • 02Provides Gym-style market environments for stock trading and portfolio allocation
  • 03Downloads and preprocesses market data from sources including Yahoo Finance, Alpaca and Binance
  • 04Adds technical indicators such as MACD, RSI and Bollinger Bands
  • 05Runs backtests and compares agents against MVO and DJIA baselines

Use cases

  • Learning how reinforcement learning is applied to trading problems
  • Prototyping DRL trading strategies in academic research
  • Benchmarking new agents against classic stock trading environments
  • Experimenting with portfolio allocation on historical market data

Quick start

  1. 1

    Clone the repository

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

    Enter the project folder

    cd FinRL
  3. 3

    Create and activate a virtual environment

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

    Install FinRL

    pip install -e .

Things to know

  • The README positions this repo as the original educational/research version; the authors point users to FinRL-X/FinRL-Trading for production use.
  • Data downloads depend on external sources such as Yahoo Finance and often need API keys or accounts for others like Alpaca or WRDS.

Topics

FAQ

What is FinRL?
An open-source Python framework for applying deep reinforcement learning to automated stock trading and portfolio tasks. FinRL is a Python framework for building financial reinforcement learning trading agents. It organizes work into three layers: market environments that simulate trading tasks, DRL agents that learn decision-making policies, and financial applications such as stock trading and portfolio allocation. An agent interacts with a market environment and learns a policy through train, test and trade stages.
Is FinRL free to use? What license does it have?
FinRL is open source under the MIT license. Check the license terms before using it in commercial products.
Is FinRL still maintained?
Actively maintained. The last commit to FinRL was on Oct 20, 2026.
What can I use FinRL for?
Learning how reinforcement learning is applied to trading problems Prototyping DRL trading strategies in academic research Benchmarking new agents against classic stock trading environments Experimenting with portfolio allocation on historical market data
How do I install FinRL?
Clone the repository: git clone https://github.com/AI4Finance-Foundation/FinRL.git Enter the project folder: cd FinRL Create and activate a virtual environment: python3 -m venv venv && source venv/bin/activate Install FinRL: pip install -e .
Where can I get FinRL?
The source code and installation instructions are on GitHub: https://github.com/AI4Finance-Foundation/FinRL

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects