FinRL®: Financial Reinforcement Learning


FinGPT: Open-source for open-finance! Revolutionize FinTech.
Financial reinforcement learning (FinRL®) (Document website) is the first open-source framework for financial reinforcement learning. FinRL has evolved into an ecosystem
FinRL-DeepSeek: LLM-Infused Risk-Sensitive Reinforcement Learning for Trading Agents
Dev Roadmap | Stage | Users | Project | Description |
---|---|---|---|---|
0.0 (Preparation) | entrance | practitioners | FinRL-Meta | gym-style market environments |
1.0 (Proof-of-Concept) | full-stack | developers | this repo | automatic pipeline |
2.0 (Professional) | profession | experts | ElegantRL | algorithms |
3.0 (Production) | service | hedge funds | Podracer | cloud-native deployment |
Outline
Overview
FinRL has three layers: market environments, agents, and applications. For a trading task (on the top), an agent (in the middle) interacts with a market environment (at the bottom), making sequential decisions.

A quick start: Stock_NeurIPS2018.ipynb. Videos FinRL at AI4Finance Youtube Channel.
File Structure
The main folder finrl has three subfolders applications, agents, meta. We employ a train-test-trade pipeline with three files: train.py, test.py, and trade.py.
Supported Data Sources
Data Source | Type | Range and Frequency | Request Limits | Raw Data | Preprocessed Data |
---|---|---|---|---|---|
Akshare | CN Securities | 2015-now, 1day | Account-specific | OHLCV | Prices&Indicators |
Alpaca | US Stocks, ETFs | 2015-now, 1min | Account-specific | OHLCV | Prices&Indicators |
Baostock | CN Securities | 1990-12-19-now, 5min | Account-specific | OHLCV | Prices&Indicators |
Binance | Cryptocurrency | API-specific, 1s, 1min | API-specific | Tick-level daily aggegrated trades, OHLCV | Prices&Indicators |
CCXT | Cryptocurrency | API-specific, 1min | API-specific | OHLCV | Prices&Indicators |
EODhistoricaldata | US Securities | Frequency-specific, 1min | API-specific | OHLCV | Prices&Indicators |
IEXCloud | NMS US securities | 1970-now, 1 day | 100 per second per IP | OHLCV | Prices&Indicators |
JoinQuant | CN Securities | 2005-now, 1min | 3 requests each time | OHLCV | Prices&Indicators |
QuantConnect | US Securities | 1998-now, 1s | NA | OHLCV | Prices&Indicators |
RiceQuant | CN Securities | 2005-now, 1ms | Account-specific | OHLCV | Prices&Indicators |
Sinopac | Taiwan securities | 2023-04-13~now, 1min | Account-specific | OHLCV | Prices&Indicators |
Tushare | CN Securities, A share | -now, 1 min | Account-specific | OHLCV | Prices&Indicators |
WRDS | US Securities | 2003-now, 1ms | 5 requests each time | Intraday Trades | Prices&Indicators |
YahooFinance | US Securities | Frequency-specific, 1min | 2,000/hour | OHLCV | Prices&Indicators |
OHLCV: open, high, low, and close prices; volume. adjusted_close: adjusted close price
Technical indicators: 'macd', 'boll_ub', 'boll_lb', 'rsi_30', 'dx_30', 'close_30_sma', 'close_60_sma'. Users also can add new features.
Installation
Install description for all operating systems (MAC OS, Ubuntu, Windows 10)
FinRL for Quantitative Finance: Install and Setup Tutorial for Beginners
Status Update
2022-06-25 0.3.5: Formal release of FinRL, neo_finrl is chenged to FinRL-Meta with related files in directory: meta.
2021-08-25 0.3.1: pytorch version with a three-layer architecture, apps (financial tasks), drl_agents (drl algorithms), neo_finrl (gym env)
2020-12-14 Upgraded to Pytorch with stable-baselines3; Remove tensorflow 1.0 at this moment, under development to support tensorflow 2.0
2020-11-27 0.1: Beta version with tensorflow 1.5
Tutorials
[Towardsdatascience] Deep Reinforcement Learning for Automated Stock Trading
Publications
Title | Conference/Journal | Link | Citations | Year |
---|---|---|---|---|
Dynamic Datasets and Market Environments for Financial Reinforcement Learning | Machine Learning - Springer Nature | paper code | 7 | 2024 |
FinRL-Meta: FinRL-Meta: Market Environments and Benchmarks for Data-Driven Financial Reinforcement Learning | NeurIPS 2022 | paper code | 37 | 2022 |
FinRL: Deep reinforcement learning framework to automate trading in quantitative finance | ACM International Conference on AI in Finance (ICAIF) | paper | 49 | 2021 |
FinRL: A deep reinforcement learning library for automated stock trading in quantitative finance | NeurIPS 2020 Deep RL Workshop | paper | 87 | 2020 |
Deep reinforcement learning for automated stock trading: An ensemble strategy | ACM International Conference on AI in Finance (ICAIF) | paper code | 154 | 2020 |
Practical deep reinforcement learning approach for stock trading | NeurIPS 2018 Workshop on Challenges and Opportunities for AI in Financial Services | paper code | 164 | 2018 |
News
[量化投资与机器学习] 基于深度强化学习的股票交易策略框架(代码+文档)
[深度强化实验室] 【重磅推荐】哥大开源“FinRL”: 一个用于量化金融自动交易的深度强化学习库
[Kaggle] Jane Street Market Prediction
[矩池云Matpool] 在矩池云上如何运行FinRL股票交易策略框架
[Neurohive] FinRL: глубокое обучение с подкреплением для трейдинга
[知乎] 动态数据驱动的金融强化学习
Citing FinRL
We published FinRL papers that are listed at Google Scholar. Previous papers are given in the list.
Join and Contribute
Welcome to AI4Finance community!
Please check Contributing Guidances.
Contributors
Thank you!
LICENSE
MIT License
Disclaimer: We are sharing codes for academic purpose under the MIT education license. Nothing herein is financial advice, and NOT a recommendation to trade real money. Please use common sense and always first consult a professional before trading or investing.