用于基于AkShare数据的风险标签生成场景。适用于金融工作中的基础任务单元。
本 Skill 使用 AkShare 提供的 A 股市场数据接口进行风险标签打标,主要包括:
stock_zh_a_spot_em:A 股实时行情快照,用于获取最新价、涨跌幅、成交量、成交额、换手率、市盈率等基础指标。stock_zh_a_hist:A 股历史行情,用于计算近 N 日波动率、回撤、均线偏离、成交额均值等风险特征。stock_individual_info_em:个股基础信息(如股票简称、总市值等),用于补充个股静态属性。说明:不同 AkShare 版本的字段命名可能略有差异,脚本中已尽量兼容常见字段名,但建议在生产使用前结合实际环境验证一次。
本 Skill 面向 A 股股票池进行风险标签打标,输出每只股票的风险标签、风险分数和综合风险等级。
st_risk:证券简称包含 ST、*ST 等特殊处理标识。high_volatility_20d:近 20 个交易日年化波动率偏高。large_drawdown_60d:近 60 个交易日最大回撤较大。low_liquidity:近 20 个交易日平均成交额偏低,流动性不足。abnormal_turnover:最新换手率异常偏高。near_limit_down:最新单日跌幅接近跌停风险区间。penny_stock:股价过低,价格脆弱性更高。below_ma20:股价低于 20 日均线,短期趋势偏弱。脚本会为每只股票输出:
low / medium / high)默认输出到:
output/risk_labels.csvoutput/risk_labels.jsonpip install akshare pandas numpy
python script/risk_labeling.py
python script/risk_labeling.py --symbols 600519,000001,300750
python script/risk_labeling.py --limit 50
python script/risk_labeling.py --output-dir ./output
MIT License
Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.