OpenParable
Skip to content
← Back to skills

A Share Reinforcement Trading

Agent Building
a-share-reinforcement-trading

A Share Reinforcement Trading is an Agent Skill for agent building published in the aifinlab/FinClaw repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

A股强化学习交易策略。当用户说"强化学习"、"reinforcement learning"、"RL交易"、"RL策略"、"DQN交易"、"PPO策略"、"智能体交易"时触发。基于 cn-stock-data 获取数据,设计RL交易环境与策略。支持 formal/brief 两种输出风格。

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/aifinlab/FinClaw/blob/HEAD/skills/a-share-reinforcement-trading/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/a-share-reinforcement-trading, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

强化学习交易策略助手

数据获取

通过 cn-stock-data skill 获取数据:

  • K线数据: 日线/分钟线序列
  • 实时行情: 环境状态更新
  • 账户数据: 持仓/资金/收益

分析工作流

Step 1: 交易环境设计

  • 状态空间:价格序列+技术指标+持仓状态
  • 动作空间:买入/卖出/持有(离散)或仓位比例(连续)
  • 奖励函数:收益率/Sharpe/风险调整收益
  • A股约束:T+1、涨跌停、手续费建模

Step 2: RL算法选择

  • DQN:离散动作空间,适合简单买卖决策
  • PPO/A2C:连续动作空间,适合仓位管理
  • SAC:最大熵框架,探索与利用平衡好
  • 多智能体RL:多股票组合的协同决策

Step 3: 训练与调优

  • 经验回放:打破时序相关性
  • 课程学习:从简单市场环境逐步增加复杂度
  • 奖励塑形:避免稀疏奖励导致训练困难
  • 超参数:学习率/折扣因子/网络结构搜索

Step 4: 策略评估与部署

  • 样本外回测:未见过的市场数据测试
  • 与基准策略对比:买入持有/均线策略
  • 鲁棒性测试:不同市场状态下的表现
  • 实盘模拟:Paper trading验证

Step 5: 输出报告

输出格式

formal 风格(研报级)

# RL交易策略报告

## 一、环境设计
| 组件 | 配置 |
|------|------|

## 二、训练结果
[学习曲线、收敛情况]

## 三、策略表现
[收益/Sharpe/回撤]

## 四、部署建议
[实盘注意事项]

brief 风格(快速分析)

## RL策略速览
- PPO算法,状态维度64
- 训练收敛,样本外Sharpe 1.8
- 年化收益 18%,最大回撤 12%
- 优于买入持有基准 +8%

参考 references/reinforcement-trading-guide.md 获取详细方法论与 A股实证研究。

使用示例

示例 1: 基本使用

# 调用 skill
result = run_skill({
    "param1": "value1",
    "param2": "value2"
})

示例 2: 命令行使用

python scripts/run_skill.py --input data.json