Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_crypto_intraday

Fetch intraday cryptocurrency prices at customizable intervals (1min, 5min, 1hour) using Yahoo Finance data to monitor real-time market movements and trends.

Instructions

按时间间隔获取加密货币的分时价格,支持 1min、5min 和 1hour。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
intervalNo1min
symbolYes

Implementation Reference

  • The handler function that implements the get_crypto_intraday tool by fetching intraday crypto price data from the Financial Modeling Prep API, validating the interval, and returning JSON data.
    async def get_crypto_intraday(symbol: str, interval: str = "1min") -> str:
        """获取加密货币的分时价格"""
    
        api_key = os.environ.get("FMP_API_KEY")
        if not api_key:
            return "Error: FMP_API_KEY environment variable not set."
    
        allowed = {"1min", "5min", "1hour"}
        if interval not in allowed:
            return "Error: invalid interval"
    
        url = f"https://financialmodelingprep.com/stable/historical-chart/{interval}"
        try:
            resp = requests.get(url, params={"symbol": symbol, "apikey": api_key}, timeout=10)
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting {interval} crypto data for {symbol}: {e}"
        return json.dumps(data)
  • server.py:1211-1214 (registration)
    The decorator that registers the get_crypto_intraday tool with the MCP server, including its name and description.
    @fmp_server.tool(
        name="get_crypto_intraday",
        description="""按时间间隔获取加密货币的分时价格,支持 1min、5min 和 1hour。""",
    )

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/16Coffee/finance-mcp'

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