一个通过Yahoo Finance提供全面股票筛选功能的模型上下文协议(MCP)服务器。支持LLMs根据技术分析、基本面分析和期权分析标准筛选股票,并支持观察列表管理和结果存储。
技术分析筛选
基本面筛选
期权筛选
# 安装依赖
pip install -r requirements.txt
# 克隆仓库
git clone https://github.com/twolven/mcp-stockscreen.git
cd mcp-stockscreen
claude-desktop-config.json文件中,在mcpServers部分添加以下内容:{
"mcpServers": {
"stockscreen": {
"command": "python",
"args": ["path/to/stockscreen.py"]
}
}
}
将"path/to/stockscreen.py"替换为您保存stockscreen.py文件的实际路径。
run_stock_screen{
"screen_type": "technical",
"criteria": {
"min_price": float, # 最低股价
"max_price": float, # 最高股价
"min_volume": int, # 最低平均成交量
"above_sma_200": bool, # 股价高于200日SMA
"above_sma_50": bool, # 股价高于50日SMA
"min_rsi": float, # 最低RSI值
以下省略...
{
"screen_type": "fundamental",
"criteria": {
"min_market_cap": float, # 最低市值
"min_pe": float, # 最低市盈率
"max_pe": float, # 最高市盈率
"min_dividend": float, # 最低股息收益率(%)
"min_revenue_growth": float, # 最低收入增长率
"category": str, # 可选:市值类别过滤器
# ETF特定标准
"min_aum": float, # 最低资产管理规模
"max_expense_ratio": float, # 最高费用比率
"min_volume": float # 最低交易量
},
"watchlist": str, # 可选:要筛选的观察列表名称
"save_result": str # 可选:保存结果的名称
}
{
"screen_type": "options",
"criteria": {
"min_iv": float, # 最低隐含波动率(%)
"max_iv": float, # 最高隐含波动率(%)
"min_option_volume": int, # 最低期权成交量
"min_put_call_ratio": float, # 最低持有/卖出比率
"max_spread": float, # 最大买入价/卖出价差(%)
"min_days_to_earnings": int, # 至少多少天后盈利
"max_days_to_earnings": int, # 最多多少天后盈利
"category": str # 可选:市值类别过滤器
},
"watchlist": str, # 可选:要筛选的观察列表名称
"save_result": str # 可选:保存结果的名称
}
{
"screen_type": "news",
"criteria": {
"keywords": List[str], # 在新闻中搜索的关键字
"exclude_keywords": List[str], # 排除的关键字
"min_days": int, # 向前搜索的最小天数
"max_days": int, # 向前搜索的最大天数
"management_changes": bool, # 过滤管理层变动
"require_all_keywords": bool, # 要求所有关键字匹配
"category": str # 可选:市值类别过滤器
},
"watchlist": str, # 可选:要筛选的观察列表名称
"save_result": str # 可选:保存结果的名称
}
{
"screen_type": "custom",
"criteria": {
"category": str, # 可选:市值类别过滤器
"technical": {
# 上述任何技术标准
},
"fundamental": {
# 上述任何基本面标准
},
"options": {
# 上述任何期权标准
},
"news": {
# 上述任何新闻标准
}
},
"watchlist": str, # 可选:要筛选的观察列表名称
"save_result": str # 可选:保存结果的名称
}
可用的市值类别过滤器:
manage_watchlist{
"action": str, # 必需:"create", "update", "delete", "get"
"name": str, # 必需:观察列表名称(1-50个字符,字母数字加_ -)
"symbols": List[str] # 必需用于创建/更新:股票代码列表
}
get_screening_result{
"name": str # 必需:已保存的筛选结果名称
}
{
"screen_type": "technical",
"criteria": dict, # 原始使用的标准
"matches": int, # 匹配的股票数量
"results": [ # 匹配的股票列表
{
"symbol": str,
"price": float,
"volume": float,
"rsi": float,
"sma_20": float,
"sma_50": float,
"sma_200": float,
"atr": float,
"atr_pct": float,
"price_changes": {
"1d": float, # 1日价格变化%
"5d": float, # 5日价格变化%
"20d": float # 20日价格变化%
},
"ma_distances": {
"pct_from_20sma": float,
"pct_from_50sma": float,
"pct_from_200sma": float
}
}
],
"rejected": [ # 未匹配的股票列表
{
"symbol": str,
"rejection_reasons": List[str]
}
],
"timestamp": str
}
“我已经启用了stockscreen工具,提供了股票筛选能力。您可以使用三个主要功能:
根据各种标准类型筛选股票:
管理观察列表:
访问保存的筛选结果:
所有功能都包括错误处理、详细的市场数据和全面的响应。”
欢迎贡献!请随时提交Pull Request。
此项目采用MIT许可证 - 详情见LICENSE文件。
Todd Wolven - (https://github.com/twolven)