FinRL — Deep Reinforcement Learning for Trading
AI4Finance Foundation's framework for training RL agents to trade stocks, crypto, and forex with backtesting, paper trading, and live execution support.
FinRL — Deep Reinforcement Learning for Trading
FinRL is a comprehensive deep reinforcement learning library for automated stock trading. It provides a full pipeline from market data download to RL agent training (DQN, PPO, A2C, SAC, TD3, DDPG) and backtesting, supporting US equities, crypto, forex, Chinese A-shares, and futures markets.
Key Features
- Gym-compatible trading environments with realistic transaction costs and slippage
- Built-in RL agents via Stable-Baselines3 and ElegantRL backends
- Data pipelines: Yahoo Finance, Alpaca, Binance, AkShare, WRDS
- Ensemble strategies combining multiple RL agents
- Paper trading mode via Alpaca and CCXT
- Cryptocurrency and multi-asset portfolio support
Quick Start
from finrl.meta.preprocessor.yahoodownloader import YahooDownloader
from finrl.meta.env_stock_trading.env_stocktrading import StockTradingEnv
from finrl.agents.stablebaselines3.models import DRLAgent
df = YahooDownloader(start_date="2020-01-01", end_date="2023-12-31",
ticker_list=["AAPL","MSFT","GOOG"]).fetch_data()
env = StockTradingEnv(df=df, ...)
agent = DRLAgent(env=env)
model = agent.get_model("ppo")
model.learn(total_timesteps=100_000)
npx ai-supply add finrl-deep-rl-trading
Curated mirror of the open-source FinRL (MIT). Get it from the source.
Compromise signals — malicious or tampered code (leaked secrets, backdoors, a dropped executable) — reduce the score, and known dependency CVEs carry a bounded penalty (they warrant review but never QUARANTINE — update the dependency to clear). Other dangerous-by-capability traits are risk surface, expected for some capabilities. Every finding is mapped to its OWASP control below.
Findings mapped to the OWASP Top 10 for LLM Applications (2025) and the OWASP Machine Learning Security Top 10. Expand any flagged control for the exact findings — compromise reduces the score; expected/risk-surface do not, except a known CVE, which carries a small bounded penalty (high/critical → Review).
The same gate an agent runs before installing (POST /api/v1/trust/finrl-deep-rl-trading/check). Click a policy:
Consume FinRL — Deep Reinforcement Learning for Trading programmatically. Authenticate with an API key or session — see Authorize an agent.
# Agents: CHECK BEFORE YOU INSTALL (no auth) — score, grade, level, capability manifest
curl https://ai-supply.store/api/v1/trust/finrl-deep-rl-trading
# Gate against your org policy (returns { pass, violations })
curl -X POST https://ai-supply.store/api/v1/trust/finrl-deep-rl-trading/check \
-H "Content-Type: application/json" \
-d '{"minGrade":"B","denyPermissions":["shell"],"denyUnknownEgress":true}'
# CLI
npx ai-supply add finrl-deep-rl-trading
# REST (install → download)
curl -X POST https://ai-supply.store/api/v1/listings/finrl-deep-rl-trading/install \
-H "Authorization: Bearer $AIM_KEY"
# MCP tool
install_listing({ "slug": "finrl-deep-rl-trading" })OpenAPI spec →Curated mirror — latest upstream source. See the repository for tagged releases.