1 Star 0 Fork 0

yutiansut / FinRL-Library

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

FinRL: A Deep Reinforcement Learning Framework for Quantitative Finance twitter facebook google+ linkedin

Downloads Downloads Python 3.6 PyPI

FinRL is an open source framework to help practitioners pipeline the development of trading strategies. In deep reinforcement learning (DRL), an agent learns by continuously interacting with an environment, in a trial-and-error manner, making sequential decisions under uncertainty and achieving a balance between exploration and exploitation. The open source community AI4Finance (to efficiently automate trading) provides resources about deep reinforcement learning (DRL) in quantitative finance, and aim to accelerate the paradigm shift from conventional machine learning approach to RLOps in finance.

To contribute? Please check the end of this page.

Feel free to report bugs via Github issues, join the mailing list: AI4Finance, and discuss FinRL in slack channel:



Roadmaps of FinRL:

FinRL 1.0: entry-level toturials for beginners, with a demonstrative and educational purpose.

FinRL 2.0: intermediate-level framework for full-stack developers and professionals. Check out ElegantRL

FinRL provides a unified machine learning framework for various markets, SOTA DRL algorithms, benchmark finance tasks (portfolio allocation, cryptocurrency trading, high-frequency trading), live trading, etc.

Table of Contents

Prior Arts:

We published papers in FinTech and now arrive at this project:

  • 4). FinRL: A Deep Reinforcement Learning Library for Automated Stock Trading in Quantitative Finance, Deep RL Workshop, NeurIPS 2020.
  • 3). Deep Reinforcement Learning for Automated Stock Trading: An Ensemble Strategy, paper and codes, ACM International Conference on AI in Finance, ICAIF 2020.
  • 2). Multi-agent Reinforcement Learning for Liquidation Strategy Analysis, paper and codes. Workshop on Applications and Infrastructure for Multi-Agent Learning, ICML 2019.
  • 1). Practical Deep Reinforcement Learning Approach for Stock Trading, paper and codes, Workshop on Challenges and Opportunities for AI in Financial Services, NeurIPS 2018.

News

Overview

A YouTube video about FinRL library. [YouTube] AI4Finance Channel for quant finance.

DRL Algorithms

We implemented Deep Q Learning (DQN), Double DQN, DDPG, A2C, SAC, PPO, TD3, GAE, MADDPG, MuZero, etc. using PyTorch and OpenAI Gym.

Status

Version History [click to expand]
  • 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

Installation:

Docker Installation

Option 1: Use the bin

# grant access to execute scripting (read it, it's harmless)
$ sudo chmod -R 777 docker/bin

# build the container!
$ ./docker/bin/build_container.sh

# start notebook on port 8887!
$ ./docker/bin/start_notebook.sh

# proceed to party!

Option 2: Do it manually

Build the container:

$ docker build -f docker/Dockerfile -t finrl docker/

Start the container:

$ docker run -it --rm -v ${PWD}:/home -p 8888:8888 finrl

Note: The default container run starts jupyter lab in the root directory, allowing you to run scripts, notebooks, etc.

Bare-metal installation (More difficult)

Clone this repository:

git clone https://github.com/AI4Finance-LLC/FinRL-Library.git

Install the unstable development version of FinRL:

pip install git+https://github.com/AI4Finance-LLC/FinRL-Library.git

Prerequisites

For OpenAI Baselines, you'll need system packages CMake, OpenMPI and zlib. Those can be installed as follows:

Ubuntu

sudo apt-get update && sudo apt-get install cmake libopenmpi-dev python3-dev zlib1g-dev libgl1-mesa-glx

Mac OS X

Installation of system packages on Mac requires Homebrew. With Homebrew installed, run the following:

brew install cmake openmpi

Windows 10

To install stable-baselines on Windows, please look at the documentation.

Create and Activate Python Virtual-Environment (Optional but highly recommended)

cd into this repository:

cd FinRL-Library

Under folder /FinRL-Library, create a Python virtual-environment:

pip install virtualenv

Virtualenvs are essentially folders that have copies of python executable and all python packages.

Virtualenvs can also avoid packages conflicts.

Create a virtualenv venv under folder /FinRL-Library

virtualenv -p python3 venv

To activate a virtualenv:

source venv/bin/activate

To activate a virtualenv on windows:

venv\Scripts\activate

Dependencies

The script has been tested running under Python >= 3.6.0, with the following packages installed:

pip install -r requirements.txt

Stable-Baselines3 using Pytorch

About Stable-Baselines 3

Stable-Baselines3 is a set of improved implementations of reinforcement learning algorithms in PyTorch. It is the next major version of Stable Baselines. If you have questions regarding Stable-baselines package, please refer to Stable-baselines3 installation guide. Install the Stable Baselines package using pip:

pip install stable-baselines3[extra]

A migration guide from SB2 to SB3 can be found in the documentation.

Stable-Baselines using Tensorflow 2.0

Still Under Development

Run

python main.py --mode=train

Backtesting

Use Quantopian's pyfolio package to do the backtesting.

Data

The stock data we use is pulled from Yahoo Finance API.

(The following time line is used in the paper; users can update to new time windows.)

Contributions

  • FinRL is an open source library specifically designed and implemented for quant finance. Trading environments incorporating market frictions are used and provided.
  • Trading tasks accompanied by hands-on tutorials with built-in DRL agents are available in a beginner-friendly and reproducible fashion using Jupyter notebook. Customization of trading time steps is feasible.
  • FinRL has good scalability, with a broad range of fine-tuned state-of-the-art DRL algorithms. Adjusting the implementations to the rapid changing stock market is well supported.
  • Typical use cases are selected and used to establish a benchmark for the quantitative finance community. Standard backtesting and evaluation metrics are also provided for easy and effective performance evaluation.

Citing FinRL

@article{finrl2020,
    author  = {Liu, Xiao-Yang and Yang, Hongyang and Chen, Qian and Zhang, Runjia and Yang, Liuqing and Xiao, Bowen and Wang, Christina Dan},
    journal = {Deep RL Workshop, NeurIPS 2020},
    title   = {FinRL: A Deep Reinforcement Learning Library for Automated Stock Trading in Quantitative Finance},
    url     = {https://arxiv.org/pdf/2011.09607.pdf},
    year    = {2020}
}

Call for Contributions

Will maintain FinRL with the "AI4Finance" community and welcome your contributions!

Please check the contributing guidances.

Contributors

Thanks to all the people who contribute.

Support various markets

Support more markets, so that the users can test their stategies.

SOTA DRL algorithms

Maintain a pool of DRL algorithms that can be treated as SOTA implementations.

Benchmarks for typical trading tasks

To help quants have better evaluations, will maintain benchmarks for many trading tasks, upon which you can improve for your own tasks.

Support live trading

Supporting live trading can close the simulation-reality gap, it will enable quants to switch to the real market when they are confident with their strategies.

LICENSE

MIT

The MIT License (MIT) Copyright (c) 2020 Hongyang Yang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

A Deep Reinforcement Learning Library for Automated Stock Trading in Quantitative Finance, NeurIPS 2020 DRL workshop. 展开 收起
Jupyter Notebook 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/yutiansut/FinRL-Library.git
git@gitee.com:yutiansut/FinRL-Library.git
yutiansut
FinRL-Library
FinRL-Library
master

搜索帮助