get_orderbook
Fetch current order book data for financial instruments to analyze market depth and liquidity. This tool provides institutional-grade quantitative finance capabilities for trading strategy development.
Instructions
Fetches the current order book.
NOTE: yfinance does not provide Level 2 data. This is a placeholder to demonstrate tool registration.
Args:
symbol: The ticker symbol.
Returns:
Message indicating unavailability.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes |
Implementation Reference
- tools/market_data.py:110-122 (handler)The handler function that implements the get_orderbook tool. It serves as a placeholder since yfinance does not provide Level 2 order book data.def get_orderbook(symbol: str) -> str: """ Fetches the current order book. NOTE: yfinance does not provide Level 2 data. This is a placeholder to demonstrate tool registration. Args: symbol: The ticker symbol. Returns: Message indicating unavailability. """ return f"Order book data (Level 2) is not available via free API for {symbol}."
- server.py:370-373 (registration)Registration of the get_orderbook tool (with other market data tools) in the main MCP server using the register_tools helper.register_tools( [get_price, get_fundamentals, get_orderbook], "Market Data" )
- app.py:286-286 (registration)Inclusion of get_orderbook in the tools_map dictionary used for organizing tools in the Gradio UI interface, which also supports MCP."Market Data": [get_price, get_fundamentals, get_orderbook],