Skip to main content
Glama

rolling_stats

Calculate rolling mean and volatility for financial symbols to analyze price trends and market fluctuations over specified time windows.

Instructions

Computes rolling mean and volatility.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
windowNo

Implementation Reference

  • The core handler function for the 'rolling_stats' tool. Downloads 1y price data via yfinance, computes rolling mean and standard deviation (volatility) over the specified window on closing prices, and returns the last 10 values 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 (along with related feature engineering tools) to the MCP server using the register_tools helper, which applies @mcp.tool() decorator.
    register_tools( [compute_indicators, rolling_stats, get_technical_summary], "Feature Engineering" )
  • app.py:291-291 (registration)
    Inclusion of rolling_stats in the tools_map dictionary under 'Technical Analysis' category for the Gradio UI toolbox interface.
    "Technical Analysis": [compute_indicators, rolling_stats, get_technical_summary],

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