Skip to main content
Glama

rolling_stats

Compute rolling mean and volatility for financial symbols to analyze time-series data trends and market fluctuations.

Instructions

Computes rolling mean and volatility.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
windowNo

Implementation Reference

  • The primary handler function implementing the rolling_stats MCP tool. It fetches 1 year of historical closing prices for the given symbol using yfinance, computes rolling mean and standard deviation over the specified window size (default 20), and returns the most recent 10 periods as JSON.
    def rolling_stats(symbol: str, window: int = 20) -> str: """Computes rolling mean and volatility.""" df = yf.download(symbol, period="1y", progress=False) if df.empty: return "No data" close = df['Close'] if isinstance(close, pd.DataFrame): close = close.iloc[:, 0] stats = pd.DataFrame() stats['Mean'] = close.rolling(window=window).mean() stats['Std'] = close.rolling(window=window).std() return stats.tail(10).to_json(orient="index")
  • server.py:390-393 (registration)
    Registration of the rolling_stats tool within the Feature Engineering category using the register_tools helper, which applies the @mcp.tool() decorator to enable it in the FastMCP server.
    register_tools( [compute_indicators, rolling_stats, get_technical_summary], "Feature Engineering" )

Latest Blog Posts

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/N-lia/MonteWalk'

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