Skip to main content

开盘涨股票策略 MCP 服务

基于阿里云百炼平台的 MCP (Model Context Protocol) 服务,提供沪深300成分股开盘涨幅选股策略分析工具。

功能特性

  • 获取沪深300成分股列表: 查询当前沪深300指数的成分股信息
  • 获取股票日线数据: 下载指定股票的历史K线数据
  • 运行开盘涨策略: 执行开盘涨幅选股策略,返回交易信号和收益分析
  • 生成策略报告: 输出详细的订单信息和盈亏曲线

安装

使用 uvx (推荐)

uvx kai-pan-zhang-mcp-server

从源码安装

pip install kai-pan-zhang-mcp-server

MCP 工具说明

1. get_hs300_stocks

获取沪深300成分股列表

输入参数: 无

返回: 成分股代码和名称列表

2. get_stock_daily_data

获取指定股票的日线数据

输入参数:

  • stock_code (string): 股票代码,如 "sh.600000"
  • start_date (string, 可选): 开始日期,格式 YYYY-MM-DD,默认为 "2025-01-01"

返回: 日线数据摘要信息

3. fetch_all_stock_data

批量获取沪深300所有成分股的日线数据并保存

输入参数:

  • start_date (string, 可选): 开始日期,默认为 "2025-01-01"

返回: 数据保存路径和记录数

4. run_strategy

运行开盘涨策略分析

输入参数: 无

返回: 策略执行结果,包括订单数量、累计收益率等

5. get_strategy_report

获取详细的策略报告

输入参数: 无

返回: 包含订单明细和收益分析的完整报告

6. send_email_report

发送策略报告到指定邮箱

输入参数: 无

环境变量要求: 必须设置 EMAIL_PASSWORD

返回: 发送状态

环境变量配置

  1. 登录 阿里云百炼控制台
  2. 进入 应用 -> MCP管理 -> 创建MCP服务
  3. 填写以下信息:
    • 服务名称: kai-pan-zhang-mcp
    • 部署方式: 选择 UVX
    • PyPI包名: kai-pan-zhang-mcp-server
    • Python版本: 3.10
    • 启动命令: uvx kai-pan-zhang-mcp-server

本地开发

# 克隆项目
git clone <repository-url>
cd kai-pan-zhang-mcp-server

# 创建虚拟环境
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# 安装依赖
pip install -e .

# 运行服务
python -m kai_pan_zhang_mcp.server

策略说明

开盘涨策略:

  • T-1日收盘时,计算所有沪深300成分股的收益率
  • 选择收益率最高的股票
  • 以T-1日收盘价买入,T日开盘价卖出
  • 设置手续费万分之四

依赖说明

  • mcp: MCP协议实现
  • baostock: 证券宝数据接口,获取股票行情数据
  • pandas: 数据处理
  • numpy: 数值计算
  • matplotlib: 绘制盈亏曲线
  • rich: 终端美化输出

许可证

MIT License

注意事项

  1. 本服务仅供研究和学习使用,不构成投资建议
  2. 股票市场有风险,投资需谨慎
  3. 数据来源于 baostock,可能存在延迟或错误

Metadata

Release files for kai-pan-zhang-mcp-server 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kai-pan-zhang-mcp-server 0.1.0
File Size Uploaded Provenance Actions
kai_pan_zhang_mcp_server-0.1.0.tar.gz 16.2 kB Without provenance Details for kai_pan_zhang_mcp_server-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kai-pan-zhang-mcp-server 0.1.0
File Interpreter ABI Platform Actions
kai_pan_zhang_mcp_server-0.1.0-py3-none-any.whl Python 3 none any Details for kai_pan_zhang_mcp_server-0.1.0-py3-none-any.whl

Total release size: 30.9 kB

Release files / kai_pan_zhang_mcp_server-0.1.0.tar.gz

Download URL kai_pan_zhang_mcp_server-0.1.0.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
40edc55449d6c1df59bf06cd7044d1f390cebf1957f06f3040f2c09b755eec12
BLAKE2b-256 checksum
How to use checksums
e1436e872faafa3d75fddb819fc0c8a78b7cc8a84011c712a89f5d2d5590b32b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.16

Release files / kai_pan_zhang_mcp_server-0.1.0-py3-none-any.whl

Download URL kai_pan_zhang_mcp_server-0.1.0-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f85276462a9abac4db77068120f3dabe7671eb23939c56f7016eba3bd453b309
BLAKE2b-256 checksum
How to use checksums
095e74194d26d746957541d2c9db4b33582f2980a9fac90980833e46fb13abf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.16

Security for kai-pan-zhang-mcp-server 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page