Skill flagged — suspicious patterns detected

ClawHub Security flagged this skill as suspicious. Review the scan results before using.

Ptrade Skills

v1.0.0

提供三种高级量化策略,包含小市值选股、8因子打分+ATR止损和热点行业轮动移动止损,支持实盘部署。

0· 89·1 current·1 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for martin-sh-ni/ptrade-skills.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Ptrade Skills" (martin-sh-ni/ptrade-skills) from ClawHub.
Skill page: https://clawhub.ai/martin-sh-ni/ptrade-skills
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install ptrade-skills

ClawHub CLI

Package manager switcher

npx clawhub@latest install ptrade-skills
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Suspicious
medium confidence
Purpose & Capability
Name/description match the actual code: three trading strategies (small-cap, 8-factor+ATR, sector rotation) that use a PTrade-style API. However, the skill metadata declares no required env vars or credentials, while every code file imports and calls a 'ptrade' API (get_price, order_shares, get_instrument_info, etc.). That implies missing runtime requirements (API keys, endpoint config or SDK) which is an incoherence between stated metadata and actual runtime needs.
Instruction Scope
SKILL.md and the Python files stick to trading/data tasks (selecting stocks, computing factors, placing orders). They do not attempt to read local files, system configs, or communicate with unexpected endpoints. The instructions include standard anti-lookahead rules and backtest safeguards.
Install Mechanism
No install spec (instruction-only plus included strategy files). Nothing is downloaded or installed by the skill itself — lowest-risk install model. The code does depend on an external 'ptrade' runtime/SDK which is not provided here.
!
Credentials
The code will require access to the PTrade brokerage/data API (and thus credentials or a configured runtime) but the skill metadata lists no required environment variables or primary credential. That mismatch is important: running these scripts in a live agent will likely need API keys or a configured environment; these are not declared or scoped. Also the code makes bulk requests (get_trade_calendar() then get_price for all A-shares), which may require high API quotas and could expose large amounts of portfolio/market data if used with real brokerage credentials.
Persistence & Privilege
Skill flags are default (not always:true). It does not attempt to modify other skills or persist beyond its own variables. Autonomous invocation is allowed by default but is not by itself a red flag here.
What to consider before installing
This skill contains three coherent trading strategies and uses a 'ptrade' API to fetch market data and place orders. Before installing or running it: 1) Confirm how the 'ptrade' SDK/agent runtime is configured — the skill metadata lists no API keys or env vars, but the code will need brokerage/data credentials and endpoint configuration; ask the author what credentials are required and where they are stored. 2) Do not run against real trading credentials until you test thoroughly in a sandbox/paper environment; these strategies will place orders. 3) The code requests bulk market data (all symbols from get_trade_calendar then get_price for many securities) — ensure you have API quota and that such large requests are intentional. 4) Review and test edge cases: the code swallows many exceptions (which can hide failures), mixes datetime.now and context.now (possible timing/backtest inconsistencies), and one source file in the provided manifest was truncated in the package review — request the complete files. 5) If you intend to deploy live, ask for explicit documentation of required runtime configuration (credentials, SDK version, rate limits) and run a dry-run/paper backtest first.

Like a lobster shell, security has layers — review code before you run it.

latestvk97arj38aayse0jqtrte6p29b984qhmk
89downloads
0stars
1versions
Updated 2w ago
v1.0.0
MIT-0

PTrade 高级量化策略 Skill(2026-04-10)

定位

基于 Martin 多年量化研究 + 国金 PTrade 高级编程规范,生成三个可直接部署的实盘策略。


策略一:纯小市值策略(推荐 ⭐)

文件: ptrade_smallcap_final.py

核心逻辑:每周一买市值最小的股票,持有5天,不追高。

选股规则:

  • 市值 ≤ 60亿
  • 股价 ≤ 12元
  • MA60 多头排列(收盘价 > MA60)
  • 过滤 ST、停牌、涨跌停

交易规则:

  • 调仓日:每月 1日 和 15日(TRADE_DAYS=[1,15])
  • 持有期:HOLD=5天(第6天尾盘卖出)
  • 买入:T+1 日 09:30 开盘价买入(不是14:50!)
  • 止损:单只跌幅 -8% 立即止损
  • 熔断:净值从高点回撤 -10% 停止开仓

回测结果(2018-2026):

  • 年化 +12.91%,夏普 0.53,回撤 -57%,胜率 53%

关键结论:纯小市值就是最优,附加任何选股因子都在帮倒忙。风控因子(止损/ATR/仓位)不属于附加因子,应保留。


策略二:8因子候选 + ATR 追踪止损

文件: ptrade_c31_momentum.py

核心逻辑:在纯小市值基础上,加入8因子打分体系 + ATR 动态风控。

8因子打分(≥6分入选):

  1. 动量因子(20日涨幅,排名前30%→+2分)
  2. 成交量因子(换手率,排名前30%→+2分)
  3. 相对强弱 RSI(40-70区间→+1分)
  4. 波动率因子(ATR 适中 → +1分)
  5. 突破因子(收盘价 > 20日高点 → +2分)
  6. 趋势因子(MA5 > MA10 > MA20 → +2分)
  7. 量价配合(上涨带量 → +1分)
  8. 抗跌因子(beta < 1 → +1分)

ATR 追踪止损(优于固定止损):

  • 止损线 = 当前价 - 2 * ATR
  • 自适应不同波动率股票

动态仓位:

  • ATR ≤ 2% → 仓位 80%
  • ATR 2%-5% → 仓位 50%
  • ATR ≥ 5% → 仓位 30%

黑天鹅防护:

  • 指数当日跌幅 ≥ 3% → 减半仓
  • 指数当日跌幅 ≥ 5% → 清仓

策略三:热点行业轮动 + 移动止损(新方向 🔥)

文件: ptrade_sector_rotation.py

核心逻辑:每月初选最强赛道,8%移动止损兜底。

赛道池: 半导体、新能源、证券、医药、创业板 ETF

动量选股: 每月初以过去20天涨幅筛选最强赛道

移动止损: 从持仓最高点回撤 8% 立即清仓

仓位: 全仓1只ETF(集中持仓,追求弹性)

预期表现: 年化 30%-45%,夏普 1.5-1.8,最大回撤 18%-25%

风险提示: 单边熊市会频繁触发止损,策略不适配单边暴跌行情。


PTrade 无未来函数铁律

  1. 严禁 iloc[-1] 取当日数据(当日K线未完成)
  2. iloc[-2] 取昨日收盘数据
  3. 回测 end_date 必须用前一日,不能用当天
  4. 财务数据用"公告日期"不用"报告期"
  5. get_prev_trade_date() 获取前一交易日

过拟合防控红线

  • 样本外回撤 ≤ 样本内 1.2 倍
  • 样本外年化 ≥ 样本内 0.7 倍
  • 参数数量 ≤ 5 个
  • 最优参数周围 ±20% 必须盈利(不能孤立峰值)

Task C 研究方向(2026-04-10 更新)

P0 核心优化:

  1. C3.1 策略分钟级回测 — 验证 T+1 开盘价买入效果
  2. ATR 止损参数调优 — 固定 -5% vs ATR×2 对比
  3. 动态仓位实盘化 — ATR 波动率自适应仓位

P1 扩展验证: 4. 热点行业轮动 + 移动止损 — 小市值股验证 5. Walk-Forward 前向分析 — 滚动训练/测试 6. 黑天鹅防护参数验证

P2 长期研究: 7. 分批止盈策略(≥15%卖50%,≥30%卖30%) 8. RSI 均值回归 + 动量融合 9. 量化归因分析

Comments

Loading comments...