Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_crypto_price_eod

Retrieve historical end-of-day cryptocurrency prices via Yahoo Finance MCP Server, supporting both light and full data modes for analysis and insights.

Instructions

获取加密货币的历史收盘价,可选简略或完整模式。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNolight
symbolYes

Implementation Reference

  • Handler function implementing the get_crypto_price_eod tool logic, fetching historical EOD crypto prices from Financial Modeling Prep API in light or full mode.
    async def get_crypto_price_eod(symbol: str, mode: str = "light") -> str:
        """获取加密货币 EOD 数据"""
    
        api_key = os.environ.get("FMP_API_KEY")
        if not api_key:
            return "Error: FMP_API_KEY environment variable not set."
    
        base = "https://financialmodelingprep.com/stable/historical-price-eod"
        endpoint_map = {"light": "light", "full": "full"}
        endpoint = endpoint_map.get(mode.lower())
        if not endpoint:
            return "Error: invalid mode"
    
        url = f"{base}/{endpoint}"
        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 {mode} crypto prices for {symbol}: {e}"
        return json.dumps(data)
  • server.py:1184-1187 (registration)
    Registers the get_crypto_price_eod tool with the MCP server using the @tool decorator, including name and description.
    @fmp_server.tool(
        name="get_crypto_price_eod",
        description="""获取加密货币的历史收盘价,可选简略或完整模式。""",
    )

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