Skip to main content
Glama
24mlight

A-Share MCP Server

get_month_end_trading_dates

Retrieve month-end trading dates for China's A-share market by specifying a year. This tool helps identify the last trading day of each month for scheduling and analysis purposes.

Instructions

Return month-end trading dates for a given year.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYes

Implementation Reference

  • The core handler function that implements the logic to retrieve the last trading day of each month for a given year by querying the financial data source for trading days in the week leading up to the month's end.
    def get_month_end_trading_dates(data_source: FinancialDataSource, *, year: int) -> str: results = [] for month in range(1, 13): last_day = calendar.monthrange(year, month)[1] start_date = datetime(year, month, last_day - 7).strftime("%Y-%m-%d") end_date = datetime(year, month, last_day).strftime("%Y-%m-%d") df = _fetch_trading_days(data_source, start_date=start_date, end_date=end_date) trading_days = df[df["is_trading_day"] == "1"]["calendar_date"].tolist() if trading_days: results.append(trading_days[-1]) return ", ".join(results)
  • The tool registration decorator (@app.tool()) and wrapper function that handles the tool invocation, logging context, and delegates execution to the use_cases layer handler.
    @app.tool() def get_month_end_trading_dates(year: int) -> str: """Return month-end trading dates for a given year.""" return run_tool_with_handling( lambda: uc_date.get_month_end_trading_dates(active_data_source, year=year), context=f"get_month_end_trading_dates:{year}", )

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