Skip to main content
Glama
24mlight

A-Share MCP Server

get_last_n_trading_days

Retrieve recent trading dates for China's A-share market to analyze market activity, schedule transactions, or calculate time-based metrics.

Instructions

Return the last N trading dates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNo

Implementation Reference

  • Core implementation of get_last_n_trading_days: fetches trading days data and returns the last N dates as a comma-separated string.
    def get_last_n_trading_days(data_source: FinancialDataSource, *, days: int) -> str: today = datetime.now() start = (today - timedelta(days=days * 2)).strftime("%Y-%m-%d") end = today.strftime("%Y-%m-%d") df = _fetch_trading_days(data_source, start_date=start, end_date=end) trading_days = df[df["is_trading_day"] == "1"]["calendar_date"].tolist() return ", ".join(trading_days[-days:]) if trading_days else ""
  • Registers the MCP tool 'get_last_n_trading_days' with @app.tool(), defining input schema (days: int=5) and delegating to the use case via run_tool_with_handling.
    @app.tool() def get_last_n_trading_days(days: int = 5) -> str: """Return the last N trading dates.""" return run_tool_with_handling( lambda: uc_date.get_last_n_trading_days(active_data_source, days=days), context=f"get_last_n_trading_days:{days}", )

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/24mlight/a-share-mcp-is-just-i-need'

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