Skip to content
Back to skills

A Share Strategy Mainboard Multi Swing Defensive

ASecurity

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

  • 242 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 28, 2026
ai-agentspythonbashapi

Works with

  • cli
  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 28, 2026

npx -y skills add shouldnotappearcalm/a-share-skill --skill a-share-strategy-mainboard-multi-swing-defensive --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of A Share Strategy Mainboard Multi Swing Defensive?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for A Share Strategy Mainboard Multi Swing Defensive
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/shouldnotappearcalm-a-share-strategy-mainboard-multi-swing-defensive/badge)](https://www.skillsdirectory.com/skills/shouldnotappearcalm-a-share-strategy-mainboard-multi-swing-defensive)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

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

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

本 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` 表示历史上与策略文档一致的**日内止损比例参考**,本脚本**不**替你监控盘中止损,需自行在下单软件中设置。

## 环境与依赖

```bash
pip install akshare pandas numpy requests
```

## 运行

```bash
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`:关闭参数邻域一致性过滤(仅在调试时使用)

示例:

```bash
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` 输出的代码配合使用:

```bash
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.py` | `trend_pullback` |
| `scripts/strategy_lab/indicators.py` | 均线、RSI |
| `scripts/strategy_lab/strategy_params.py` | 默认参数与策略名 |

## 与执行层衔接

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

Files in this skill

  • SKILL.md6 KB
  • scripts/daily_decisions.py13.7 KB
  • scripts/paper_trading/market_data.py30.1 KB
  • scripts/realtime_quotes.py5.8 KB
  • 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.