is_trading_day
Check if a specific date is a trading day for A-share stock markets to plan investments and avoid non-trading periods.
Instructions
Check if a specific date is a trading day.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes |
Implementation Reference
- src/tools/date_utils.py:37-43 (handler)The MCP tool handler for 'is_trading_day', decorated with @app.tool() for automatic registration and execution. It wraps the use case call with error handling.@app.tool() def is_trading_day(date: str) -> str: """Check if a specific date is a trading day.""" return run_tool_with_handling( lambda: uc_date.is_trading_day(active_data_source, date=date), context=f"is_trading_day:{date}", )
- src/use_cases/date_utils.py:56-62 (helper)Core helper function implementing the trading day check by fetching trade dates from data source and inspecting the 'is_trading_day' field.def is_trading_day(data_source: FinancialDataSource, *, date: str) -> str: df = _fetch_trading_days(data_source, start_date=date, end_date=date) if df.empty: return "未知" row = df.iloc[0] return "是" if str(row.get("is_trading_day", "")) == "1" else "否"
- mcp_server.py:56-56 (registration)Invocation of the registration function that defines and registers the 'is_trading_day' tool along with other date utilities.register_date_utils_tools(app, active_data_source)