Skip to main content
Glama

Financial News and Notes MCP Server

MIT License
129
199
  • Apple
  • Linux
ma.js960 B
// MA 移动平均线技术指标计算模块 /** * 计算简单移动平均线 (SMA) * @param prices 价格数组 * @param period 计算周期 */ export function calculateSMA(prices, period) { const sma = []; for (let i = 0; i < prices.length; i++) { if (i < period - 1) { sma.push(NaN); } else { const sum = prices.slice(i - period + 1, i + 1).reduce((a, b) => a + b, 0); sma.push(sum / period); } } return sma; } /** * 计算指数移动平均线 (EMA) * @param prices 价格数组 * @param period 计算周期 */ export function calculateEMA(prices, period) { const ema = []; const multiplier = 2 / (period + 1); for (let i = 0; i < prices.length; i++) { if (i === 0) { ema.push(prices[i]); } else { ema.push((prices[i] * multiplier) + (ema[i - 1] * (1 - multiplier))); } } return ema; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/guangxiangdebizi/my-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server