Security Stock Picker — 安全股票选股器
v1.0.0针对中国A股市场的AI驱动股票选股引擎,结合量化因子筛选、基本面分析、技术信号和行业轮动...
运行时依赖
安装命令
点击复制技能文档
AI-Powered Stock Selection Engine / 智能选股引擎 智能选股引擎——整合量化因子筛选、基本面分析、技术信号检测、行业轮动分析的全流程选股工具。解决痛点:信息过载、情绪化决策、选股标准不统一。适用:各级投资者、基金经理、量化分析师。
行业痛点 / 行业痛点 痛点 / 痛点 | 影响 | 解决方案 ---|---|--- 信息过载 | A股5000+股票,无法逐一研究 | 多维度因子筛选,快速缩小范围 情绪化决策 | 追涨杀跌,高买低卖 | 量化标准选股,避免主观干扰 选股标准模糊 | 没有系统性方法论 | 完整选股框架+评分模型 财报造假风险 | 康美药业、瑞幸等案例警示 | 财报异常信号检测+预警 行业轮动难把握 | 踏错节奏,板块轮动踏空 | 宏观+情绪+资金三维轮动模型
触发关键词 / 触发关键词 English Triggers:stock selection, quantitative screening, factor investing, fundamental analysis, technical analysis, China A-share, stock picker, AI investing, momentum stocks, value investing, growth stocks, sector rotation, portfolio construction 中文触发词(优先):选股 / 智能选股 / 量化选股 / 因子选股 / 基本面选股 / 技术面选股 / 价值投资 / 成长股 / 蓝筹股 / 小盘股 / 行业轮动 / 板块轮动 / 资金流向 / 北向资金 / 龙虎榜 / 涨停板 / 破净股 / 低估值 / 高成长 / 业绩超预期 / 财报选股 / 研报筛选 / AI选股 / 机器选股 / 组合构建 / 仓位管理 / 止损策略
核心能力 / 核心能力
- 量化因子筛选 / Quantitative Factor Screening
import pandas as pd
import numpy as np
from typing import List, Dict, Optionalclass StockScreener:
"""智能选股引擎"""
def __init__(self):
self.factors = {
# 估值因子
"pe": {"name": "市盈率", "weight": 0.15, "direction": "low_better", "bounds": (0, 100)},
"pb": {"name": "市净率", "weight": 0.10, "direction": "low_better", "bounds": (0, 10)},
"ps": {"name": "市销率", "weight": 0.05, "direction": "low_better", "bounds": (0, 20)},
"pcf": {"name": "市现率", "weight": 0.05, "direction": "low_better", "bounds": (0, 30)},
# 成长因子
"revenue_growth": {"name": "营收增速", "weight": 0.15, "direction": "high_better", "bounds": (-50, 100)},
"profit_growth": {"name": "利润增速", "weight": 0.15, "direction": "high_better", "bounds": (-100, 200)},
"gross_margin": {"name": "毛利率", "weight": 0.08, "direction": "high_better", "bounds": (0, 100)},
# 质量因子
"roe": {"name": "ROE", "weight": 0.12, "direction": "high_better", "bounds": (-20, 50)},
"debt_ratio": {"name": "资产负债率", "weight": 0.05, "direction": "low_better", "bounds": (0, 100)},
"current_ratio": {"name": "流动比率", "weight": 0.03, "direction": "high_better", "bounds": (0.5, 10)},
# 动量因子
"momentum_20d": {"name": "20日动量", "weight": 0.05, "direction": "high_better", "bounds": (-30, 50)},
"momentum_60d": {"name": "60日动量", "weight": 0.02, "direction": "high_better", "bounds": (-50, 100)}
}
def screen(self, stocks: pd.DataFrame, criteria: Dict[str, tuple], min_score: float = 60) -> pd.DataFrame:
"""量化筛选主函数
Args:
stocks: 股票数据(含各因子列)
criteria: 筛选条件 {因子名: (最小值, 最大值)}
min_score: 最低综合评分
Returns:
符合条件的股票
"""
result = stocks.copy()
# Step 1: 硬性条件筛选
for factor, (min_val, max_val) in criteria.items():
if factor in result.columns:
result = result[(result[factor] >= min_val) & (result[factor] <= max_val)]
# Step 2: 因子打分
result = self._factor_scoring(result)
# Step 3: 综合评分排序
result = result[result["综合评分"] >= min_score].sort_values("综合评分", ascending=False)
return result
def _factor_scoring(self, df: pd.DataFrame) -> pd.DataFrame:
"""因子打分(百分制)"""
scores = pd.DataFrame(index=df.index)
for factor, config in self.factors.items():
if factor in df.columns:
raw = df[factor].copy()
min_val, max_val = config["bounds"]
# 标准化到0-100
normalized = (raw - min_val) / (max_val - min_val) 100
normalized = normalized.clip(0, 100)
# 方向调整(部分因子越低越好)
if config["direction"] == "low_better":
normalized = 100 - normalized
scores[factor] = normalized config["weight"]
df["综合评分"] = scores.sum(axis=1)
return df
- 主题投资筛选 / Thematic Stock Screening
THEMATIC_SCREENING = {
"AI人工智能": {
"核心标的": ["科大讯飞", "海康威视", "中科曙光", "寒武纪", "商汤-W"],
"概念股池": {
"基础层": ["芯片", "算力", "服务器"],
"技术层": ["大模型", "算法", "API"],
"应用层": ["办公", "医疗", "金融", "教育"]
},
"筛选标准": {
"市值": ">100亿",
"研发投入": ">10%",
"AI收入占比": ">30%"
},
"风险提示": "技术迭代快,竞争格局未定,估值波动大"
},
"新能源汽车": {
"核心标的": ["比亚迪", "宁德时代", "理想汽车-W", "小鹏汽车-W"],
...