is_trading_day
Determine if a specific date is a trading day for China's A-share stock market to plan investment activities 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)MCP tool handler and registration for 'is_trading_day'. It wraps the use case function with error handling and logging via run_tool_with_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-61 (helper)Core logic for determining if a date is a trading day. Fetches trade dates from data source and checks the 'is_trading_day' column value.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)Top-level registration call that sets up the date utils tools, including 'is_trading_day'.register_date_utils_tools(app, active_data_source)