股票数据协议服务

一个基于Rust编写的股票数据协议服务器,提供实时和历史股票价格数据获取功能,适用于个人学习和研究。

  • by hoqqun
  • Shell
  • 本地部署
  • 9 星标
  • 更新于
在 GitHub 查看 hoqqun/stooq-mcp

使用说明

stooq mcp

日本语

用Rust编写的模型上下文协议(MCP)服务器,从中获取股票价格数据 stooq.com.

演示

https://github.com/user-attachments/assets/63b55175-80c3-42aa-a28a-bdb21c66169e

特性

  • 最新股价 -获取实时股价数据
  • 历史数据 -使用自定义日期范围检索历史库存数据
  • 多市场支持 -访问来自5个主要市场的股票

支持的市场

市场代码 国家
jp 日本
us 美国
uk 联合王国
hk 香港
de 德国

安装

先决条件

  • 锈蚀1.75+
  • 货物

一个衬里安装

curl -fsSL https://raw.githubusercontent.com/hoqqun/stooq-mcp/main/install.sh | bash

这将安装到 ~/.stooq-mcp/。要自定义:

STOOQ_MCP_DIR=/your/path curl -fsSL https://raw.githubusercontent.com/hoqqun/stooq-mcp/main/install.sh | bash

快速安装

git clone https://github.com/hoqqun/stooq-mcp.git
cd stooq-mcp
./install.sh

安装脚本将:

  1. 构建项目
  2. 在Claude Code和/或Claude Desktop注册

手动构建

cargo build --release

二进制文件将位于 ./target/release/stooq-mcp.

用法

克劳德代码

使用Claude代码注册MCP服务器:

claude mcp add stooq-mcp /path/to/stooq-mcp/target/release/stooq-mcp

克劳德桌面版

将以下内容添加到您的Claude Desktop配置文件中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "stooq-mcp": {
      "command": "/path/to/stooq-mcp/target/release/stooq-mcp"
    }
  }
}

工具

get_stock_price

从stooq.com获取股票价格数据。

参数

参数 类型 必填 说明
ticker string ✅ 股票代码(例如。, "7203", "AAPL")
market string ✅ 市场代码: jp, us, uk, hk, de
start_date string ❌ 开始日期 YYYYMMDD 格式(例如。, "20240101")
end_date string ❌ 结束日期 YYYYMMDD 格式(例如。, "20241231")

示例

获取最新股价

丰田汽车(日本):

Get the current stock price for Toyota (7203) in Japan market.

苹果公司(美国):

Get the latest AAPL stock price from US market.

获取历史数据

索尼(日本)-2024全年:

Get Sony (6758) stock price history from January 1, 2024 to December 31, 2024.

响应格式

最新数据:

Symbol,Date,Time,Open,High,Low,Close,Volume
7203.JP,2024-12-27,16:00:00,2500,2520,2480,2510,1000000

历史数据:

Date,Open,High,Low,Close,Volume
2024-01-04,2450,2480,2440,2470,800000
2024-01-05,2470,2490,2460,2485,750000
...

技术栈

  • 锈 -系统编程语言
  • rmcp -MCP服务器实现
  • reqwest -HTTP客户端
  • 东京 -异步运行时

局限性

⚠️ 重要通知

  • stooq.com是一个 非官方API 如有更改,恕不另行通知
  • 每日费率限制 apply-过多的请求可能会被阻止
  • 旨在 个人使用和学习目的 仅
  • 数据准确性无法保证

许可证

MIT许可证-请参阅 许可证 了解详情。

贡献

欢迎投稿!请随时提交拉取请求。