get_money_supply_data_month
Retrieve monthly money supply data to analyze economic conditions and monetary policy trends for financial research and market analysis.
Instructions
Monthly money supply data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start_date | No | ||
| end_date | No | ||
| limit | No | ||
| format | No | markdown |
Implementation Reference
- src/tools/macroeconomic.py:51-59 (handler)The MCP tool handler implementation. Decorated with @app.tool() to register and execute the tool logic by delegating to the use case function with shared error handling.@app.tool() def get_money_supply_data_month(start_date: Optional[str] = None, end_date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str: """Monthly money supply data.""" return run_tool_with_handling( lambda: fetch_money_supply_data_month( active_data_source, start_date=start_date, end_date=end_date, limit=limit, format=format ), context="get_money_supply_data_month", )
- src/data_source_interface.py:113-116 (schema)Abstract method in the FinancialDataSource interface defining the expected signature for monthly money supply data retrieval.@abstractmethod def get_money_supply_data_month(self, start_date: Optional[str] = None, end_date: Optional[str] = None) -> pd.DataFrame: """Fetches monthly money supply data (M0, M1, M2).""" pass
- src/use_cases/macroeconomic.py:31-35 (helper)Use case helper that validates input, fetches raw data from the data source, and formats the output as markdown table.def fetch_money_supply_data_month(data_source: FinancialDataSource, *, start_date: Optional[str], end_date: Optional[str], limit: int, format: str) -> str: validate_output_format(format) df = data_source.get_money_supply_data_month(start_date=start_date, end_date=end_date) meta = {"dataset": "money_supply_month", "start_date": start_date, "end_date": end_date} return format_table_output(df, format=format, max_rows=limit, meta=meta)
- src/baostock_data_source.py:677-680 (helper)Concrete data source implementation that queries Baostock API for monthly money supply data (M0, M1, M2).def get_money_supply_data_month(self, start_date: Optional[str] = None, end_date: Optional[str] = None) -> pd.DataFrame: """Fetches monthly money supply data (M0, M1, M2) using Baostock.""" # Baostock expects YYYY-MM format for dates here return _fetch_macro_data(bs.query_money_supply_data_month, "Monthly Money Supply", start_date, end_date)
- src/tools/macroeconomic.py:22-70 (registration)Registration function that defines and registers all macroeconomic tools including get_money_supply_data_month using @app.tool() decorators. Called from mcp_server.py.def register_macroeconomic_tools(app: FastMCP, active_data_source: FinancialDataSource): """Register macroeconomic tools.""" @app.tool() def get_deposit_rate_data(start_date: Optional[str] = None, end_date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str: """Benchmark deposit rates.""" return run_tool_with_handling( lambda: fetch_deposit_rate_data(active_data_source, start_date=start_date, end_date=end_date, limit=limit, format=format), context="get_deposit_rate_data", ) @app.tool() def get_loan_rate_data(start_date: Optional[str] = None, end_date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str: """Benchmark loan rates.""" return run_tool_with_handling( lambda: fetch_loan_rate_data(active_data_source, start_date=start_date, end_date=end_date, limit=limit, format=format), context="get_loan_rate_data", ) @app.tool() def get_required_reserve_ratio_data(start_date: Optional[str] = None, end_date: Optional[str] = None, year_type: str = '0', limit: int = 250, format: str = "markdown") -> str: """Required reserve ratio data.""" return run_tool_with_handling( lambda: fetch_required_reserve_ratio_data( active_data_source, start_date=start_date, end_date=end_date, year_type=year_type, limit=limit, format=format ), context="get_required_reserve_ratio_data", ) @app.tool() def get_money_supply_data_month(start_date: Optional[str] = None, end_date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str: """Monthly money supply data.""" return run_tool_with_handling( lambda: fetch_money_supply_data_month( active_data_source, start_date=start_date, end_date=end_date, limit=limit, format=format ), context="get_money_supply_data_month", ) @app.tool() def get_money_supply_data_year(start_date: Optional[str] = None, end_date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str: """Yearly money supply data.""" return run_tool_with_handling( lambda: fetch_money_supply_data_year( active_data_source, start_date=start_date, end_date=end_date, limit=limit, format=format ), context="get_money_supply_data_year", )