Repolode
AI4Finance-Foundation

AI4Finance-Foundation/FinRL-Trading

A modular Python quant trading framework covering stock selection, portfolio allocation, backtesting and Alpaca broker execution with one weight-based interface.

Stars
3,912
Forks
1,133
Open issues
53
Last commit
2 months ago

Repolode describes open-source projects and does not give investment advice. Trading and investing can lose money: assess the risk yourself and follow the laws where you live before using this project.

What is it?

FinRL-X is an AI-native quantitative trading infrastructure from the AI4Finance Foundation, successor to the original FinRL framework. It organizes strategies as a pipeline that outputs a target portfolio weight vector, so the same weights feed both the backtesting engine and live execution.

The project covers data ingestion from Yahoo Finance, FMP and WRDS with SQLite caching, ML-based stock selection (a Random Forest selector), portfolio allocators such as equal weight, mean-variance, minimum variance and a DRL allocator, plus timing and portfolio-level risk overlays. Backtests run on the bt library with multi-benchmark comparison and transaction costs.

Live and paper trading go through Alpaca with multi-account support and pre-trade risk checks. It ships with a CLI entry point, a deploy script, a Python API and an example Jupyter workflow. The project is intended for research and education, not as financial advice.

Key features

  • 01Weight-centric pipeline where selection, allocation, timing and risk overlays are swappable modules.
  • 02Data loading from Yahoo Finance, FMP and WRDS with SQLite caching.
  • 03Backtesting via the bt engine with multi-benchmark comparison and transaction costs.
  • 04Alpaca paper and live trading with multi-account support and pre-trade risk checks.
  • 05Included strategies: ML stock selection, DRL allocation (PPO/SAC), and adaptive multi-asset rotation.

Use cases

  • Researching ML or DRL-based stock selection and portfolio allocation on US equities.
  • Backtesting multi-asset strategies against SPY and QQQ benchmarks.
  • Running paper-trading experiments with Alpaca before any live deployment.
  • Teaching quantitative finance with a reproducible Python workflow.

Quick start

  1. 1

    Clone the repository

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

    Create a virtual environment (Python 3.11+), then activate it

    python3 -m venv venv
  3. 3

    Install dependencies

    pip install -r requirements.txt
  4. 4

    Run an adaptive rotation backtest with deploy.sh

    ./deploy.sh --strategy adaptive_rotation --mode backtest

Things to know

  • Requires Python 3.11 or newer.
  • Paper and live trading need Alpaca API credentials in a .env file.
  • The performance results in the README are the authors' own backtests and paper trading over specific periods.

Topics

#quantitative-trading#algorithmic-trading#deep-reinforcement-learning#portfolio-optimization#backtesting#alpaca#stock-selection#finance#a2c-algorithm#automated-stock-trading

FAQ

What is FinRL-Trading?
A modular Python quant trading framework covering stock selection, portfolio allocation, backtesting and Alpaca broker execution with one weight-based interface. FinRL-X is an AI-native quantitative trading infrastructure from the AI4Finance Foundation, successor to the original FinRL framework. It organizes strategies as a pipeline that outputs a target portfolio weight vector, so the same weights feed both the backtesting engine and live execution.
Is FinRL-Trading free to use? What license does it have?
FinRL-Trading is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is FinRL-Trading still maintained?
Updated within 6 months. The last commit to FinRL-Trading was on Sep 18, 2026.
What can I use FinRL-Trading for?
Researching ML or DRL-based stock selection and portfolio allocation on US equities. Backtesting multi-asset strategies against SPY and QQQ benchmarks. Running paper-trading experiments with Alpaca before any live deployment. Teaching quantitative finance with a reproducible Python workflow.
How do I install FinRL-Trading?
Clone the repository: git clone https://github.com/AI4Finance-Foundation/FinRL-Trading.git Create a virtual environment (Python 3.11+), then activate it: python3 -m venv venv Install dependencies: pip install -r requirements.txt Run an adaptive rotation backtest with deploy.sh: ./deploy.sh --strategy adaptive_rotation --mode backtest
Where can I get FinRL-Trading?
The source code and installation instructions are on GitHub: https://github.com/AI4Finance-Foundation/FinRL-Trading

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

Related projects