# FinRL-X

FinRL's successor, carrying one portfolio-weight vector from stock selection to Alpaca.

**Best for:** Python users who want a weight-based pipeline from quarterly stock selection to Alpaca rebalancing as code to read and fork; not for anyone who needs a clean pip install or a backtest that applies its own risk exits.

*https://stockmarketstack.com/tools/finrl-x · Backtesting Frameworks & Algo Trading Libraries*

## Facts

### At a glance

| Field | Value |
| --- | --- |
| Vendor | AI4Finance Foundation |
| Category | Backtesting Frameworks & Algo Trading Libraries |
| Job | live_trading |
| Website | https://github.com/AI4Finance-Foundation/FinRL-Trading |
| Pricing model | open-source |
| Free tier | true |
| Open source | true |
| Licence | Apache-2.0 |
| Self-hosted | true |
| Tested hands-on | no |
| Claimed by vendor | no |
| Last updated | 2026-10-08 |

### Coverage

| Field | Value |
| --- | --- |
| Asset classes | stocks, etf |
| Markets | us |
| Works outside the US | false |
| Data latency | none |
| Platforms | library, cli |
| AI features | research |

### Interfaces

| Field | Value |
| --- | --- |
| API | false |
| Webhooks | false |
| Scripting | Python |
| Python | true |
| Spreadsheet add-in | false |
| MCP server | false |
| Export | csv |

### Capabilities

Yes: backtesting, automation, live_trading, paper_trading

No: charting, screening, scanning, portfolio_tracking, broker_import, tax_reporting, alerts, news, options_analysis

*Verified: pricing 2026-10-08; capabilities 2026-10-08; coverage 2026-10-08.*

## What it is

FinRL-X is the AI4Finance Foundation's portfolio-trading framework, and the project
[FinRL](https://stockmarketstack.com/tools/finrl)'s README now sends new users to. It is not FinRL renamed. FinRL still takes
commits in its own repository; FinRL-X lives in FinRL-Trading, a repository begun in May 2020 for
a DRL stock-trading paper, rewritten from September 2025 and retitled FinRL-X in March 2026
alongside an arXiv paper (2603.21330).

What changed is the interface. FinRL gives an agent a gym environment and takes back trade
quantities. In FinRL-X every strategy returns a vector of target portfolio weights. The vector
passes through four optional stages (stock selection, allocation, timing and a risk overlay) and
then goes to either a backtest or a broker. The shipped modules are:

- an ML stock selector, which scores quarterly fundamentals with random forest, LightGBM and
  XGBoost over point-in-time S&P 500 membership;
- equal-weight and minimum-variance allocation inside the selector, and a separate module with
  mean-variance and DRL allocators;
- a rules-based weekly rotation across 21 stocks and ETFs, which `deploy.sh` runs end to end.

"AI-native" and "the LLM era" describe less code than they suggest. The only LLM call in the tree
sends FMP news articles to OpenAI (`gpt-4o-mini` by default) for a sentiment label and stores the
label in SQLite. No strategy, backtest or trading module reads it.

The DRL module is where FinRL-X is still FinRL. It imports FinRL's `StockPortfolioEnv` and its
Stable-Baselines3 `DRLAgent` wrapper, plus PyPortfolioOpt for mean-variance. Neither FinRL nor
PyPortfolioOpt is listed in `requirements.txt` or `setup.py`, so that path means installing both
yourself.

Apache-2.0 per the LICENSE file since 3 October 2025; the repository was MIT before that. About
3,800 stars, not archived.

## Pricing

Nothing is for sale. The code is Apache-2.0 and there is no hosted version. finrl.ai, where the
foundation advertises a paid FinRL tier, does not mention FinRL-X. What you pay for are the
accounts the code calls. The ML selector needs a [Financial Modeling Prep](https://stockmarketstack.com/tools/financial-modeling-prep)
key for its fundamentals and news, trading needs an Alpaca account, and sentiment labels need an
OpenAI key.

## Data & coverage

- The unified data manager registers one source, Financial Modeling Prep. Without a key it runs
  "offline" from its SQLite cache. It pulls quarterly statements and ratios, S&P 500 constituents,
  daily prices and news.
- Yahoo Finance is not behind that manager, although the README calls it the free default.
  `deploy.sh` downloads daily bars through [yfinance](https://stockmarketstack.com/tools/yfinance) into `data/fmp_daily/`,
  keeping open, high, low, close and volume and dropping the adjusted close.
- WRDS appears in the README's architecture table and in the settings class. No fetcher reads it.
- The repository ships two datasets. One is a 24 MB file of quarterly fundamentals for 715
  tickers, June 2015 to March 2026, which its documentation says was built from FMP's API. The
  other is a set of daily S&P 500 membership snapshots from 2 January 1996 to 17 April 2026.
  Neither file states terms of use.
- Quarterly figures are mapped to a trade date about two months after quarter end (31 March to
  1 June), so the selector does not trade on a report before it could have been filed.
- US stocks and ETFs, one broker (Alpaca), daily bars.

## Integrations

Python 3.11 or later. Backtests go through [bt](https://stockmarketstack.com/tools/bt), at a flat 0.1% per trade unless you
pass a bt cost model such as Almgren-Chriss (supported since April 2026). Execution
calls Alpaca's REST API with `requests` directly, not through the alpaca-py SDK that
`requirements.txt` installs. Several accounts can be configured in `.env`. A rebalance cancels
open orders, sells before it buys, and sends market orders with day time-in-force. When the market
is closed it either skips, the default, or queues at-the-open orders. A Streamlit dashboard and a
Dockerfile are included.

## Limitations

- **Installing it is the first obstacle.** The PyPI wheel (2.0.2, November 2025) predates the
  release and lacks the `src` package its modules import, as well as the base-strategy and rotation
  modules. It also installs top-level packages named `config`, `data` and `utils` into your
  environment. From a clone, `pip install -r requirements.txt` fails on the `finnhub` line, and the
  Dockerfile runs the same command.
- **The bt backtest fills at the close of the weight's own date.** Each weight date rebalances at
  that day's adjusted close, with no next-bar delay and no spread or slippage unless you configure
  a cost model. Weights are rescaled to sum to one, so cash left in a weight vector gets invested.
- **The rotation backtest that `deploy.sh` runs does not use bt.** It compounds weekly
  close-to-close returns on the weekly weights, with no transaction costs and on closes that are
  not adjusted for dividends. Its daily stop-loss and fast risk-off triggers are printed but never
  applied to the equity curve; the code's own comment says position sizes "would be reduced in
  live trading". The rotation's 21 symbols are fixed in its YAML file and used unchanged on every
  backtest date.
- **The README's results tables are the authors' own runs**, and the README does not say which
  backtest path produced them. This card does not reprint them.
- **The pre-trade risk checks cover one path.** The $100,000 per-order cap and 50% turnover cap
  run only in `TradeExecutor.execute_strategy`. The rebalance call that the README demonstrates,
  and that `deploy.sh` uses, skips them.
- **It has broken quietly before.** Until a fix merged on 18 September 2026, the ML selector's
  `generate_weights()` raised `AttributeError` on every call, according to the fix's commit
  message. The repository has no tests and no CI.
- **The README is out of step with the code.** Its "start here" notebook was deleted in October
  2025, and its Python example imports `MLStockSelectorStrategy`, a class that does not exist.

## Alternatives

[FinRL](https://stockmarketstack.com/tools/finrl) is the same foundation's gym-environment library, still the one for
reproducing deep-RL trading papers. [bt](https://stockmarketstack.com/tools/bt) is the engine under FinRL-X's backtest; with a
weight vector already in hand, use it directly. [Lumibot](https://stockmarketstack.com/tools/lumibot) and [LEAN](https://stockmarketstack.com/tools/lean)
run one strategy class in backtest and live, with more brokers. [Qlib](https://stockmarketstack.com/tools/qlib) covers ML stock
selection with its own data store and no broker.

## FAQ

### Is FinRL-X just FinRL under a new name?

No. FinRL is still developed in its own repository, and FinRL-X is a separate codebase in a separate one, FinRL-Trading, where strategies return portfolio weights instead of acting inside a gym environment. The only code it takes from FinRL is the DRL allocator, which imports FinRL's portfolio environment and agent wrapper without declaring FinRL as a dependency.

### Can I install FinRL-X with pip?

Not usefully. `pip install finrl-trading` gets 2.0.2, uploaded on 23 November 2025, four months before the v1.0.0 GitHub release. Its modules import a `src` package the wheel does not contain. Installing from a clone fails too, because `requirements.txt` asks for `finnhub>=2.4.19`, a PyPI name with no files, which issue 81 has reported since January 2026. The `deploy.sh` script sidesteps this by installing only the six packages its rotation backtest needs, eight for paper trading.

### Is FinRL-X maintained?

Lightly. On 8 October 2026 the last commit to master was 18 September 2026, two merged community fixes; the commit before that was 4 September, and before that 2 May. There is one release, v1.0.0 on 25 March 2026. 39 issues and 15 pull requests were open, and one account wrote 52 of the 69 commits made in 2026.

### Can FinRL-X trade a real Alpaca account?

The library can, the shipped script will not. `AlpacaManager` sends orders to whatever base URL you configure, so pointing it at Alpaca's live endpoint trades real money. `deploy.sh` checks the URL and exits if the account is not a paper one. Either way the rebalance goes out as market orders with day time-in-force, and by default nothing is sent while the market is closed.

## Also from AI4Finance Foundation

- [FinGPT](https://stockmarketstack.com/tools/fingpt.md)
- [FinRL](https://stockmarketstack.com/tools/finrl.md)
- [FinRobot](https://stockmarketstack.com/tools/finrobot.md)

## Also worth comparing

- [ib_async](https://stockmarketstack.com/tools/ib-async.md) — The community continuation of ib_insync — same API, new maintainers, TWS still required.
- [LEAN](https://stockmarketstack.com/tools/lean.md) — QuantConnect's engine without the cloud — your server, your data, your broker login.
- [Lumibot](https://stockmarketstack.com/tools/lumibot.md) — One strategy class for backtest and live, plus a built-in LLM agent runtime.
- [Backtrader](https://stockmarketstack.com/tools/backtrader.md) — An event-driven Python backtester with 122 indicators, frozen since April 2023.
- [bt](https://stockmarketstack.com/tools/bt.md) — Python backtesting for allocation and rebalancing rules, not entries and exits.
- [fastquant](https://stockmarketstack.com/tools/fastquant.md) — A one-call wrapper over Backtrader, dormant since 2023 and broken on PyPI.
