← Back to Skills Marketplace
aidalong

港股日内交易复盘

by AIdalong · GitHub ↗ · v1.0.3 · MIT-0
cross-platform ⚠ suspicious
108
Downloads
0
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install hk-intraday-trading
Description
基于盘前选股和实时行情,自动生成港股日内交易买入、卖出、止损价格及复盘结果,支持飞书消息推送。
README (SKILL.md)

港股日内交易复盘技能

目录

  1. 核心交易逻辑
  2. 选股策略
  3. 交易价格计算策略
  4. 复盘策略
  5. 飞书消息推送
  6. 报告格式
  7. 文件结构

核心交易逻辑(重要!)

盘前选股 → 盘中执行 → 盘后复盘

交易执行规则

  1. 盘前:给出选股信息(目标买入价、目标卖出价、止损价)
  2. 默认按选股信息交易:不干预,默认会成交
  3. 盘中
    • 触发买入价 → 成交买入
    • 买入后触发止损价 → 触发止损,卖出
    • 买入后触发卖出价 → 触发止盈,卖出
    • 没有触发买入价 → 不买入(没有成交)
  4. 盘后复盘:根据实际价格走势判断结果

复盘结果(只有3种)

结果 说明 触发条件
没有成交 未触发买入价,未买入 最低价 > 目标买入价
买入后止损 触发止损价卖出 最低价 \x3C= 买入价 AND 最低价 \x3C= 止损价
买入后卖出 触发卖出价止盈 最低价 \x3C= 买入价 AND 最高价 >= 卖出价

注意:自动复盘系统会自动根据当日行情判断结果,无需手动记录


选股策略

选股时间

  • 盘前选股:每个交易日上午 09:15-09:25(港股开盘前)
  • 选股时机:在开盘前完成选股,给出交易计划
  • 定时任务:建议设置 cron 任务在每个交易日的 09:15 执行选股

数据源

可用数据源列表

数据源 状态 测试日期 说明
东方财富 API ✅ 可用 2026-03-13 免费,无需 API Key,稳定可靠
腾讯财经 API ✅ 可用 2026-03-13 免费,直接 HTTP 请求
easyquotation 库 ✅ 可用 2026-03-13 封装腾讯财经 API,易于使用
finance-data skill ⚠️ 不适用 - 仅提供历史数据,不适合实时选股

1. 东方财富 API(推荐)

  • 接口地址https://push2.eastmoney.com/api/qt/stock/get
  • 接口参数
    • secid=116.{股票代码} (116 代表港股)
    • fields=f43,f44,f45,f46,f47,f48,f60,f169,f170,f171,f177
  • 返回字段说明
    字段 说明
    f43 当前价格(需除以1000)
    f44 最高价(需除以1000)
    f45 最低价(需除以1000)
    f47 成交量
    f170 涨跌幅(需除以100)
    f177 振幅(需除以100)

测试命令

curl -s "https://push2.eastmoney.com/api/qt/stock/get?secid=116.00700&fields=f43,f44,f45,f170,f177,f47"

测试结果

{"data": {"f43": 545500, "f44": 551500, "f45": 543500, "f47": 2895136, "f170": -18, "f177": 384}}

✅ 解析:价格 545.5港元,涨跌幅 -1.8%,振幅 3.84%

2. 腾讯财经 API(备用)

  • 接口地址https://qt.gtimg.cn/q=hk{股票代码}
  • 特点:免费,稳定,返回数据格式特殊需要解析

测试命令

curl -s "https://qt.gtimg.cn/q=hk00700"

测试结果:✅ 可用,返回包含价格、涨跌幅、成交量等数据

3. easyquotation 库(推荐)

  • 安装pip install easyquotation
  • 使用
import easyquotation
quote = easyquotation.use('hkquote')
data = quote.stocks(['00700', '09988'])

测试结果

✅ easyquotation 可用: 
  00700 腾讯控股: price=545.0, Pchange=-1.5, Amp=1.46
  09988 阿里巴巴: price=132.2, Pchange=0.6, Amp=1.67

4. finance-data skill

  • 结论:⚠️ 不适用于日内交易实时选股
  • 原因:该 skill 主要提供历史数据查询(港股日线、分钟线),不适合实时数据获取
  • 适用场景:盘后复盘获取历史 K 线数据

数据源选择建议

  1. 首选:东方财富 API - 直接 HTTP 请求,无需额外依赖
  2. 备选:easyquotation 库 - 封装良好,易于使用
  3. 备用:腾讯财经 API - 直接请求腾讯接口
  4. 不使用:finance-data skill(仅历史数据)

选股指标

基于以下指标进行选股:

  1. 涨跌幅 (Pchange)

    • 最佳范围:-2.0% ~ +1.5%
    • 理由:日内交易需要波动,但涨幅不能太大否则没有空间
  2. 振幅 (Amp)

    • 最佳范围:2.0% ~ 4.0%
    • 理由:振幅太小没有交易空间,振幅太大风险高
  3. 成交量 (amount)

    • 最小要求:300万股以上
    • 理由:流动性要好,便于买入和卖出
  4. 技术指标

    • RSI:30-70 之间最佳
    • 行业偏好:科技股 +8分,金融股 +5分

选股流程

# 伪代码
1. 获取股票池(25只主流港股)
2. 调用东方财富API获取实时数据
3. 过滤条件:
   - 涨跌幅 > -3%
   - 振幅 >= 1%
   - 成交量 >= 300万
   - RSI 在 30-70 之间
4. 对满足条件的股票进行评分
5. 按评分排序,选出最高分的股票
6. 计算交易价格(买入价、卖出价、止损价)
7. 生成交易计划并推送

评分体系

总分 100 分,各指标分配:

指标 分数范围 评分规则
涨跌幅 0-30分 -2%+1.5%得25分,+1.5%+3%得18分,-3%~-2%得15分
波动性 0-25分 2%~4%振幅得20分,1.5%~2%得15分
流动性 0-15分 成交量越高分数越高
技术面 0-20分 RSI在40-60得15分,行业加成
综合 0-10分 数据完整性奖励

评分 >= 75:强烈买入信号 评分 65-74:关注 评分 55-64:持有 评分 \x3C 55:观望


交易价格计算策略

价格计算公式

基于股票的振幅(ATR)计算交易价格:

# 输入参数
current_price = 当日收盘价或当前价
atr_pct = 振幅 / 100  # 转换为小数

# 根据评分确定目标收益和止损比例
if score >= 80:
    target_gain_pct = atr_pct * 0.8    # 目标获取80%振幅
    stop_loss_pct = atr_pct * 0.4      # 止损40%振幅
elif score >= 70:
    target_gain_pct = atr_pct * 0.6
    stop_loss_pct = atr_pct * 0.5
elif score >= 60:
    target_gain_pct = atr_pct * 0.5
    stop_loss_pct = atr_pct * 0.6
else:
    target_gain_pct = atr_pct * 0.4
    stop_loss_pct = atr_pct * 0.7

# 计算交易价格
buy_price = round(current_price * 0.995, 3)    # 比当前价低0.5%买入
sell_target = round(current_price * (1 + target_gain_pct), 3)  # 卖出目标
stop_loss = round(current_price * (1 - stop_loss_pct), 3)      # 止损价格

# 风险收益比
risk_reward_ratio = target_gain_pct / stop_loss_pct

价格计算原则

  1. 买入价:比当前价低 0.5%,给市场调整空间
  2. 卖出目标:根据评分和振幅计算,评分越高,目标收益越高
  3. 止损价格:评分越高,止损越紧(但不超过振幅的 70%)
  4. 风险收益比:至少 1:1,最好 1.5:1 以上

复盘策略

复盘时间

  • 盘后复盘:每个交易日下午 16:30(港股收盘后)
  • 定时任务:建议设置 cron 任务在每个交易日的 16:30 执行复盘

复盘数据

需要获取以下数据:

  1. 交易计划数据(选股时生成)

    • 股票代码
    • 目标买入价
    • 目标卖出价
    • 止损价
    • 选股评分
  2. 当日实际行情数据(从东方财富 API 获取)

    • 最高价
    • 最低价
    • 收盘价
    • 涨跌幅
    • 振幅

复盘逻辑

自动判断:根据当日行情自动判断交易结果,无需手动输入

结果类型(只有3种)

结果 说明 触发条件
没有成交 未触发买入价,未买入 最低价 > 目标买入价
买入后止损 触发止损价卖出 最低价 \x3C= 买入价 AND 最低价 \x3C= 止损价
买入后卖出 触发卖出价止盈 最低价 \x3C= 买入价 AND 最高价 >= 卖出价

自动判断脚本

# 自动复盘(默认昨天)
python scripts/auto_review.py

# 指定日期复盘
python scripts/auto_review.py --date 2026-03-13

自动判断流程

  1. 读取昨日选股结果(包含买入价、卖出价、止损价)
  2. 获取当日实际行情(最高价、最低价、收盘价)
  3. 自动判断结果类型并计算收益
  4. 更新 performance_tracking.json
  5. 生成复盘报告

判断逻辑

# 自动判断伪代码
if 最低价 \x3C= 目标买入价:
    # 触发了买入
    if 最高价 >= 目标卖出价:
        result = "sell_achieved"  # 买入后卖出(止盈)
    elif 最低价 \x3C= 止损价:
        result = "stop_loss"      # 买入后止损
    else:
        result = "sell_achieved"  # 持有到收盘,按收盘价计算收益
else:
    # 没有触发买入价
    result = "no_buy"  # 没有成交

复盘结果判定

结果 触发条件 记录方式
没有成交 最低价 > 目标买入价 no_buy
买入后止盈 最低价 \x3C= 买入价 AND 最高价 >= 卖出价 sell_achieved
买入后止损 最低价 \x3C= 买入价 AND 最低价 \x3C= 止损价 stop_loss

注:hold_to_close(持有到收盘)归入 sell_achieved 的边界情况,最终统计时归为止盈未触发。

策略优化

根据复盘结果,反推选股策略问题:

1. 如果 "没有成交" 居多

问题诊断

  • 目标买入价设置过低
  • 开盘前选股时数据不完整
  • 选股时间过早

优化建议

  • 调整买入价为当前价的 99% 而不是 99.5%
  • 延后选股时间到 10:00 后(等数据稳定)
  • 增加选股数量,分散风险

2. 如果 "止损" 居多

问题诊断

  • 选的股票日内走势向下
  • 止损设置过紧
  • 振幅计算不准确

优化建议

  • 增加选股时的趋势判断(涨跌幅为正更好)
  • 放宽止损到 1.5%-2%
  • 使用更可靠的数据源(避免错误数据导致策略失效)

3. 如果 "止盈" 居多

问题诊断

  • 选的股票日内走势向上
  • 止损设置合理

优化建议

  • 保持当前策略
  • 可以适当提高止盈目标

飞书消息推送

配置方法

1. 飞书机器人 Webhook

  1. 在飞书群聊中添加自定义机器人
  2. 获取 Webhook 地址(格式:https://open.feishu.cn/open-apis/bot/v2/hook/{webhook_id}
  3. 将 Webhook 地址配置到 feishu_config.json
{
  "enabled": true,
  "webhook_url": "https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "secret": "your_secret_key",
  "notify_types": {
    "selection": true,
    "review": true,
    "error": true
  },
  "message_format": "rich"
}

2. OpenClaw 飞书配置

  • 在 OpenClaw 中配置飞书应用
  • 确保应用有发送消息的权限
  • 获取 app_idapp_secret

推送格式

选股结果推送(富文本格式)

{
  "msg_type": "post",
  "content": {
    "post": {
      "zh_cn": {
        "title": "🎯 港股选股结果",
        "content": [
          [
            {"tag": "text", "text": "🏆 首选股票:"},
            {"tag": "text", "text": "00700 腾讯控股", "bold": true}
          ],
          [
            {"tag": "text", "text": "💰 交易计划:"}
          ],
          [
            {"tag": "text", "text": "买入价:"},
            {"tag": "text", "text": "¥380.50", "color": "blue"}
          ],
          [
            {"tag": "text", "text": "卖出目标:"},
            {"tag": "text", "text": "¥390.00 (+2.5%)", "color": "green"}
          ],
          [
            {"tag": "text", "text": "止损价:"},
            {"tag": "text", "text": "¥375.00 (-1.5%)", "color": "red"}
          ],
          [
            {"tag": "text", "text": "风险收益比:"},
            {"tag": "text", "text": "1.67:1"}
          ]
        ]
      }
    }
  }
}

复盘结果推送(富文本格式)

{
  "msg_type": "post",
  "content": {
    "post": {
      "zh_cn": {
        "title": "📊 港股复盘报告",
        "content": [
          [
            {"tag": "text", "text": "📈 交易统计:"}
          ],
          [
            {"tag": "text", "text": "• 买入达成:1/1 (100%)"}
          ],
          [
            {"tag": "text", "text": "• 卖出达成:1/1 (100%)"}
          ],
          [
            {"tag": "text", "text": "• 止损触发:0/1 (0%)"}
          ],
          [
            {"tag": "text", "text": "✅ 选股策略评价:"}
          ],
          [
            {"tag": "text", "text": "今日策略表现良好,选中的股票成功触发止盈"}
          ]
        ]
      }
    }
  }
}

定时任务

选股任务(每个交易日 09:15)

# OpenClaw cron 配置
cron:
  - name: "港股早盘选股"
    schedule: "0 15 * * 1-5"  # 周一至周五 09:15
    command: "python /path/to/hk_best_picker_real_fixed.py"
    on_success:
      - type: feishu
        message: "选股结果消息"

复盘任务(每个交易日 16:30)

# OpenClaw cron 配置
cron:
  - name: "港股收盘复盘"
    schedule: "0 30 * * 1-5"  # 周一至周五 16:30
    command: "python /path/to/scripts/auto_review.py"
    on_success:
      - type: feishu
        message: "复盘报告消息"

推送触发条件

消息类型 触发条件 推送时间
选股结果 每日开盘前 09:15-09:25
选股异常 选股失败时 立即推送
复盘结果 每日收盘后 16:30-16:45
策略预警 连续3天选股失败 立即推送

文件结构

hk-intraday-trading/
├── SKILL.md                    # 技能说明文档
├── template.md                 # 报告模板
├── data/
│   ├── strategy_config.json    # 策略配置
│   └── performance_tracking.json  # 性能追踪数据
├── scripts/
│   ├── hk_simple_picker.py     # 选股脚本(生成交易价格)
│   ├── auto_review.py          # 自动复盘脚本 ⭐
│   ├── review_analyzer.py      # 复盘分析器
│   ├── trading_cli.py          # 交易CLI工具
│   └── ...
├── output/
│   ├── picks/                  # 选股结果
│   │   ├── picks_YYYY-MM-DD.json
│   │   └── picks_report_YYYY-MM-DD.md
│   ├── reviews/                # 复盘报告 ⭐
│   │   └── review_YYYY-MM-DD.md
│   └── 复盘分析_YYYY-MM-DD.md
└── examples/
    └── sample_report_YYYY-MM-DD.md

核心脚本

脚本 用途 运行时间
hk_simple_picker.py 盘前选股,生成交易价格 交易日 09:15
auto_review.py 盘后自动复盘,判断结果 交易日 16:30

更新日志

  • 2026-03-14:实现自动复盘功能,无需手动记录结果;选股器现在生成交易价格
  • 2026-03-13:移除旧版内容,统一报告格式;修复数据源逻辑,数据失败直接返回失败
  • 2026-03-06:创建技能,包含完整的复盘报告模板
  • 2026-03-05:参考用户提供的格式模板优化结构
  • 2026-03-04:基于实际交易复盘需求设计

注意事项

  1. 所有价格单位均为港元
  2. 时间使用北京时间(GMT+8)
  3. 百分比计算保留两位小数
  4. 报告生成后建议保存到指定目录归档
  5. 数据源获取失败时,直接返回错误,不使用假数据
Usage Guidance
This package is inconsistent: metadata claims 'no env vars' and 'instruction-only', but multiple included Python scripts perform network calls and expect credentials (e.g., TUSHARE_TOKEN) and will send Feishu notifications. Before running or installing: 1) Inspect the functions that perform outbound requests (_send_feishu_notification and any code that posts to external URLs) to confirm where data is sent. 2) Do not provide real API tokens/webhooks until you review and trust the code — consider using dummy tokens in a sandbox. 3) Ensure you install and audit required Python dependencies (requests, easyquotation, tushare) from trusted sources, or run inside an isolated environment/container. 4) If you plan to run automated cron tasks, test scripts interactively first and verify they only write into the skill's own directories. 5) Ask the publisher for a declared list of required env vars and a requirements.txt or installation steps; absence of that information is a red flag. If you want, I can (a) list every place the code contacts external endpoints and which env vars it reads, or (b) point out the exact files/functions that trigger notifications so you can inspect them in detail.
Capability Assessment
Purpose & Capability
The name/description (HK intraday selection, price calculation, and post‑trade review with Feishu push) matches the behavior in the code: scripts fetch realtime market data, compute buy/sell/stop prices, generate reports and push notifications. However the registry metadata claims 'required env vars: none' and 'instruction-only', while multiple scripts clearly use environment variables (TUSHARE_TOKEN) and push to Feishu — this is a mismatch.
Instruction Scope
SKILL.md instructs running the included Python scripts and running curl against EastMoney/Tencent endpoints — that is within the described purpose. But the instructions and scripts reference reading/writing local files under the skill tree (output/picks, data/*.json) and performing network calls to multiple external services (eastmoney, qt.gtimg, Yahoo, Tushare, Feishu). The SKILL.md and registry do not declare or warn about required credentials (TUSHARE_TOKEN) or webhook URLs; the code may attempt outbound calls to those endpoints when run.
Install Mechanism
Registry lists no install spec (instruction-only). Yet SKILL.md and code expect Python runtime plus third‑party libraries (requests, easyquotation, possibly tushare). Dependencies are not declared in metadata (no requirements.txt, no install steps in registry). That mismatch means an operator might run scripts without reproducing required environment or vetting dependencies; missing dependency declarations lower transparency and increase risk.
Credentials
The package metadata lists no required environment variables, but code references TUSHARE_TOKEN (os.getenv) and includes code paths that send Feishu notifications (save_results calls _send_feishu_notification). Those are credential-bearing endpoints (API token, webhook) and are proportional for a skill that pushes messages and optionally queries Tushare, but they should be declared. The absence of declared primaryEnv or required env variables is an incoherence. Also scripts make outbound HTTP requests to multiple public endpoints — expected for market data but worth noting.
Persistence & Privilege
The skill does not request always:true and does not appear to modify other skills or system-wide agent settings. It writes files only within its own data/output directories (performance_tracking.json, picks files). No elevated persistence or cross-skill configuration changes were observed in the provided files.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install hk-intraday-trading
  3. After installation, invoke the skill by name or use /hk-intraday-trading
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.3
hk-intraday-trading 1.0.3 更新日志 - 优化 scripts/hk_enhanced_picker.py 实现及内容。 - 保持整体功能流程与核心交易、选股、复盘等策略说明一致。 - 文档无结构与规则变动,主流程、数据源、指标体系与交易判定策略未更改。 - 本次主要为内部脚本代码更新,无新增用户功能或行为变化。
v1.0.2
hk-intraday-trading v1.0.2 - Enhanced `scripts/hk_enhanced_picker.py` with improvements (details not specified). - No user-facing behavioral or structural changes documented.
v1.0.1
- 移除了10个过期的选股和复盘报告输出文件,精简了 output 目录。 - 不再包含 2026 年 3 月相关的 picks 和 reviews 示例数据文件。 - 其他核心策略、流程和说明文档内容保持不变。
v1.0.0
港股日内交易复盘技能 v1.0.0 首次发布 - 发布完整的港股日内交易策略与复盘流程说明文档 - 明确选股、评分、交易价格计算、复盘和推送等全链路规则 - 提供开箱即用的选股数据源和评价标准 - 详细描述自动复盘算法、结果类型和策略优化建议 - 包含飞书推送配置及消息格式示例 - 支持定时定制任务,覆盖盘前选股与盘后复盘全周期
Metadata
Slug hk-intraday-trading
Version 1.0.3
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is 港股日内交易复盘?

基于盘前选股和实时行情,自动生成港股日内交易买入、卖出、止损价格及复盘结果,支持飞书消息推送。 It is an AI Agent Skill for Claude Code / OpenClaw, with 108 downloads so far.

How do I install 港股日内交易复盘?

Run "/install hk-intraday-trading" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 港股日内交易复盘 free?

Yes, 港股日内交易复盘 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 港股日内交易复盘 support?

港股日内交易复盘 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 港股日内交易复盘?

It is built and maintained by AIdalong (@aidalong); the current version is v1.0.3.

💬 Comments