Skip to main content
Glama
al-one

MCP Server for stock and crypto

stock_info

Retrieve stock information by entering a stock symbol and market code to access fundamental data for shares traded on major exchanges.

Instructions

根据股票代码和市场获取股票基本信息, 不支持加密货币

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes股票代码
marketNo股票市场,仅支持: sh(上证), sz(深证), hk(港股), us(美股), 不支持加密货币sh

Implementation Reference

  • The handler function for the 'stock_info' MCP tool. It fetches basic stock information using akshare library functions for specified market (sh, sz, hk) and symbol, with caching.
    @mcp.tool(
        title="获取股票信息",
        description="根据股票代码和市场获取股票基本信息, 不支持加密货币",
    )
    def stock_info(
        symbol: str = field_symbol,
        market: str = field_market,
    ):
        markets = [
            ["sh", ak.stock_individual_info_em],
            ["sz", ak.stock_individual_info_em],
            ["hk", ak.stock_hk_security_profile_em],
        ]
        for m in markets:
            if m[0] != market:
                continue
            all = ak_cache(m[1], symbol=symbol, ttl=43200)
            if all is None or all.empty:
                continue
            return all.to_string()
    
        info = ak_search(symbol, market)
        if info is not None:
            return info.to_string()
        return f"Not Found for {symbol}.{market}"
  • Pydantic Field definitions used as input schema for the stock_info tool parameters: symbol and market.
    field_symbol = Field(description="股票代码")
    field_market = Field("sh", description="股票市场,仅支持: sh(上证), sz(深证), hk(港股), us(美股), 不支持加密货币")
  • The @mcp.tool decorator registers the stock_info function as an MCP tool with title and description.
    @mcp.tool(
        title="获取股票信息",
        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/al-one/mcp-aktools'

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