Coder Social home page Coder Social logo

zsl3034669 / stockrl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sunnyswag/stockrl

0.0 1.0 0.0 12.75 MB

在A股(股票)市场上训练强化学习交易智能体

License: GNU General Public License v3.0

Jupyter Notebook 98.95% Python 1.04% Shell 0.01%

stockrl's Introduction

强化学习交易股票

在A股市场上,对五个深度强化学习算法进行测试,找到比较合适的深度强化学习智能体

回测结果

回测结果展示(时间跨度为2019年1月1日至2021年1月1日)

reward.png

回测结果分析表(时间跨度为2019年1月1日至2021年1月1日,baseline 为上证50指数)

性能评价指标 上证 50 指数 A2C DDPG PPO SAC TD3
累计收益率 58.98% 108.49% 121.26% 110.85% 120.61% 120.14%
最大回撤率 -18.22% -35.83% -31.45% -16.75% -29.24% -30.69%
Omega比率 1.29 1.31 1.34 1.36 1.35 1.35
Sharpe比率 1.37 1.23 1.50 1.72 1.54 1.52
年化收益率 27.11% 46.37% 50.95% 47.23% 50.72% 50.55%
年化波动率 18.90% 36.25% 30.78% 24.28% 29.48% 29.89%

更加详细的回测结果可以查看 ./plot_traded_result.ipynb

快速开始

在终端中输入

git clone https://github.com/sunnyswag/RL_in_Stock.git
git pip install -r requirements.txt

进入 ./learn 文件夹查看详细步骤

环境设计思路

state_space 由三部分组成 :

  1. 当前的现金

  2. 每只股票的持仓量

  3. 股票数 * 环境因素(总计15个)

reward 的计算方式:

  • Reward = 累计收益率 - 当前回撤率

    reward.png

action_space 的空间:

  • actions ∈ [-x, x]

  • 正数表示买入,负数表示卖出,0 表示不进行买入卖出操作

Reference

FinRL

stockrl's People

Contributors

sunnyswag avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.