Skip to content
cccskills
FreePublished on GitHub

a-share-strategy-mainboard-multi-swing-defensive

A 股主板流动性池内按趋势回踩(trend_pullback)产出买入候选与持仓卖出信号;另有 realtime_quotes 批量拉取现价快照。供下单前决策;不跑回测、不自动下单。Use when 用户要选股、看实时报价、判断买卖信号或检查持仓是否触发离场条件。

The English summary is being prepared. Showing the original description.

See how to install

Files included (10)

  • SKILL.md6.0 KB
  • scripts/daily_decisions.py13.7 KB
  • scripts/paper_trading/__init__.py0 B
  • scripts/paper_trading/market_data.py30.1 KB
  • scripts/realtime_quotes.py5.8 KB
  • scripts/strategy_lab/__init__.py0 B
  • scripts/strategy_lab/indicators.py1.4 KB
  • scripts/strategy_lab/strategies.py9.8 KB
  • scripts/strategy_lab/strategy_params.py895 B
  • scripts/test_market_universe_filters.py1.7 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

主板多波段防御型 · 决策信号

本 skill 核心做三件事:选股范围、买入侧信号、卖出侧信号;并可选使用 realtime_quotes.py 对指定代码批量拉取现价类快照(基于 MarketDataProvider.get_quote,腾讯报价 + 分钟 K 聚合)。 输出的是决策参考(结构化列表或 JSON),不包含历史回测撮合、不包含自动报单;真实下单请用券商或另接 a-share-paper-trading 等执行通道。 策略信号定位为条件有效:在市场结构与交易成本变化下,信号强度可能衰减,需持续复核。

能力边界

做不做
从主板高流动性股票中取前 N 只构成当日股票池分钟级回测、混合回测、收益曲线
用日线 trend_pullback 标出入场/离场条件保证收益或替代投顾
给出两类「买入参考」列表(见下)直接向交易所或模拟盘服务下单
可选:读取持仓列表文件,标出「策略离场」标的替你保存实盘持仓(除非你自建文件)
批量拉取多只股票现价、涨跌幅、涨跌停参考价等(realtime_quotes.py)替代 a-share-data 的全市场实时板块、资金流等重接口

策略逻辑(与参数)

默认参数见 scripts/strategy_lab/strategy_params.py(均线快慢、回踩幅度、RSI 区间与离场 RSI 等)。 信号计算在 scripts/strategy_lab/strategies.py 的 trend_pullback。 脚本会额外应用两层过滤:

  • 成本过滤:按 --roundtrip-cost-bps 估算往返成本,只有 edge_after_cost > 0 的候选才进入最终买入列表。
  • 鲁棒性过滤:在 ROBUSTNESS_PARAM_GRID 参数邻域内计算 entry_consensus_ratio,低于 --entry-consensus-min 的候选会被过滤。

买入参考(两组,请区分语义):

  • from_previous_day_close:上一根已收盘日线满足 entry。与「前一日收盘后出信号、当日再执行」的习惯一致,更贴近事前计划。
  • from_last_close:最新一根日线也满足 entry,偏形态展示;若与上一日重复,请避免重复计数。

列表内按策略内 score(均线强弱) 降序;默认每种买入列表最多保留 5 只(strategy_params.MAX_BUY_CANDIDATES),与「同时关注仓位不宜过多」一致。需要更多或全部时加 --max-buys 0 表示不截断,或 --max-buys 10 等。

卖出参考: 对 --holdings 文件中的代码,若最新一根日线满足 exit(破慢线或 RSI 过高等规则内条件),则列入卖出参考。文件格式:一行一只代码,可含注释行(# 开头)。

风控参考(仅文档与 JSON 字段): REFERENCE_INTRADAY_STOP_PCT 表示历史上与策略文档一致的日内止损比例参考,本脚本不替你监控盘中止损,需自行在下单软件中设置。

环境与依赖

pip install akshare pandas numpy requests

运行

SKILL_DIR="<本 skill 绝对路径>"
python3 "$SKILL_DIR/scripts/daily_decisions.py" --json

常用参数:

  • --top-n:股票池大小,默认 120
  • --max-buys:买入侧列表在排序后最多保留几条,默认 5;传 0 不截断
  • --holdings:持仓代码文件路径
  • --workers:拉日线并发数
  • --json:输出一份 JSON,便于程序消费(JSON 内含截断前数量 *_total)
  • --roundtrip-cost-bps:往返交易成本估计(单位 bps),默认 45
  • --entry-consensus-min:参数邻域入场一致性阈值,默认 0.67
  • --disable-robust-check:关闭参数邻域一致性过滤(仅在调试时使用)

示例:

python3 "$SKILL_DIR/scripts/daily_decisions.py" --top-n 120 --holdings "$HOME/my_holdings.txt"

JSON 输出中会同时包含原始候选与过滤后候选:

  • from_previous_day_close_raw / from_last_close_raw:仅满足信号的原始候选
  • from_previous_day_close / from_last_close:通过成本与鲁棒过滤后的候选
  • 单条候选附带 entry_consensus_ratio、edge_after_cost、cost_filter_passed、consensus_filter_passed
  • todo_confirm_items:当前采用口径的记录项(roundtrip=45bps、consensus=0.67、RSI 区间偏移)

实时行情快照(增强)

对已知代码列表批量取报价(并发),可与 daily_decisions 输出的代码配合使用:

python3 "$SKILL_DIR/scripts/realtime_quotes.py" 600519 000001 601318 --json
python3 "$SKILL_DIR/scripts/realtime_quotes.py" -f "$HOME/my_holdings.txt" --workers 10
  • --json:输出统一 JSON(含 quotes 与逐条 details)
  • --intraday:额外拉取最后一根分钟 K(--intraday-freq 默认 5m),便于核对与日线快照的时间对齐
  • 数据来自 paper_trading/market_data.py:与全市场深度行情相比为轻量快照,盘中价格随最新分钟 K 更新

脚本布局

路径作用
scripts/daily_decisions.py入口:拉池、算信号、打印或 --json
scripts/realtime_quotes.py批量现价快照,可选附带最后一根分钟 K
scripts/paper_trading/market_data.py行情与 get_mainboard_universe
scripts/strategy_lab/strategies.pytrend_pullback
scripts/strategy_lab/indicators.py均线、RSI
scripts/strategy_lab/strategy_params.py默认参数与策略名

与执行层衔接

若要将信号落到模拟盘,可在 Agent 中组合使用 a-share-paper-trading:先读本 skill 输出,再调用模拟盘 CLI 或 HTTP API 下单;本 skill 不依赖模拟盘进程。

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

查询A股行情、历史K线与复权、财务指标、公司新闻公告、概念及入选依据、行业分类与成分、解禁、回购、股东增减持、涨停炸板详情、龙虎榜席位、板块热力图、指数、宏观及A+H上市信息。用于股票数据查询、原始数据测试和数据源异常排查。

The English summary is being prepared. Showing the original description.

shouldnotappearcalm/a-share-skill249Updated Oct 11, 2026

A股模拟盘交易与回测技能。Use when 用户要启动模拟仓服务、创建多账户、下限价单/市价单、撤单、查询持仓资金、验证涨跌停成交逻辑或运行A股回测。

The English summary is being prepared. Showing the original description.

shouldnotappearcalm/a-share-skill249Updated Oct 11, 2026

A 股全市场高流动性池内按趋势回踩(trend_pullback)产出买入候选与持仓卖出信号;另有 realtime_quotes 批量拉取现价快照。供下单前决策;不跑回测、不自动下单。Use when 用户要选股、看实时报价、判断买卖信号或检查持仓是否触发离场条件。

The English summary is being prepared. Showing the original description.

shouldnotappearcalm/a-share-skill249Updated Oct 11, 2026

A股“MACD底背离 + 零轴下二次金叉”实战分析与交易执行技能。用于把用户的盘感描述转成可执行的三档决策(上观察名单/可试错出手/必须放弃)、盘中检查单、入场与风控规则。适用于用户提到“二次金叉”“水下二次金叉”“底背离”“第一脚第二脚”“回踩验底”“MACD背离”“抄底修复”“想做但怕假信号”等场景。

The English summary is being prepared. Showing the original description.

shouldnotappearcalm/a-share-skill249Updated Oct 11, 2026

基于“均线定方向,MACD定节奏”的A股选股与交易计划技能。Use when 用户要求把均线与MACD结合做选股、筛票、盘前候选池、趋势跟随、回踩再上、金叉确认、顶背离减仓、或希望把技术判断沉淀成可执行规则与风控模板。

The English summary is being prepared. Showing the original description.

shouldnotappearcalm/a-share-skill249Updated Oct 11, 2026

基于退哥短线交易规则的A股场景化决策技能。Use when 用户要按交易场景查看短线规则、做选股、判断趋势回踩、涨停回调、连板接力、洗盘结束、卖出失效或仓位纪律。

The English summary is being prepared. Showing the original description.

shouldnotappearcalm/a-share-skill249Updated Oct 11, 2026

See all skills by shouldnotappearcalm

Report a problem with this skill