mcp-stock-analysis-server

This Node.js toolkit provides powerful features for stock data retrieval, technical indicator calculations, and sentiment analysis of news to predict stock trends. Its modular design facilitates easy integration with other APIs.

GitHub Stars

4

User Rating

Not Rated

Forks

1

Issues

0

Views

2

Favorites

0

README
股票分析工具包

这是一个功能强大的股票分析Node.js工具包,可以获取股票数据、计算技术指标、分析新闻情感并预测股票趋势。

功能特点
  • 获取股票价格数据(支持美股和中国股票)
  • 计算多种技术指标:
    • 布林带(BOLL)
    • 指数移动平均线(EMA)
    • 抛物线转向指标(SAR)
    • MACD(9,21,7)
    • 能量潮指标(OBV)
    • RSI指标
    • 成交量分析
  • 分析股票相关新闻的情感倾向
  • 综合技术指标和新闻分析预测股票趋势
  • 模块化设计,易于扩展和集成其他API
快速开始
npx mcp-stock-analysis-serve
基本使用
{
  "mcpServers": {
    "mcp-stock-analysis-server": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-stock-analysis-server"
      ],
      "env": {
        "NEWS_API_KEY": "api_key"
      }
    }
  }
}
环境变量配置
NEWS_API_KEY=your_newsapi_key
News API
  1. 访问 News API官网
  2. 注册并获取API密钥
API文档
StockAnalysis 类

参数:

  • config (Object): 配置选项
    • apiKey (String): 股票数据API密钥
    • newsApiKey (String): 新闻API密钥
    • dataProvider (String): 数据提供商名称,目前默认使用雅虎财经
方法
analyzeTrend(symbol, options)

分析股票并预测趋势。

参数:

  • symbol (String): 股票代码或名称
  • options (Object): 分析选项
    • period (Number): 分析周期(天数),默认30
    • includeNews (Boolean): 是否包含新闻分析,默认true

返回值:

  • Promise: 包含以下属性的对象
    • symbol (String): 股票代码
    • name (String): 股票名称
    • lastPrice (Number): 最新价格
    • indicators (Object): 技术指标数据
      • boll (Object): 布林带指标
      • ema (Object): EMA指标
      • sar (Object): SAR指标
      • macd (Object): MACD指标
      • obv (Object): OBV指标
      • RSI (Object): RSI指标
      • volume (Object): 成交量指标
    • newsAnalysis (Object): 新闻分析结果
      • sentiment (String): 整体情感倾向
      • score (Number): 情感分数
      • articles (Array): 分析后的文章数据
      • keywords (Array): 热点关键词
    • prediction (Object): 趋势预测结果
      • direction (String): 趋势方向(上涨/下跌/震荡)
      • strength (String): 趋势强度
      • score (Number): 综合评分
      • conclusion (String): 预测结论
    注意事项
    • News API在免费计划中也有使用限制
    许可证

    Apache License 2.0

    感谢打赏

    alt text

    使用效果

    alt text