get_orderbook
Retrieve current order book data for a specified ticker symbol to analyze market depth and liquidity, though note this implementation currently provides placeholder functionality.
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 implementing the get_orderbook tool. It takes a symbol parameter and returns a placeholder message noting that order book data is unavailable via yfinance.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 (along with get_price and get_fundamentals) in the MCP server via the register_tools helper, which applies the @mcp.tool() decorator.register_tools( [get_price, get_fundamentals, get_orderbook], "Market Data" )
- server.py:12-12 (registration)Import statement bringing the get_orderbook function into the MCP server module for registration.from tools.market_data import get_price, get_fundamentals, get_orderbook
- app.py:47-47 (registration)Import of get_orderbook in the Gradio app which also supports MCP server mode.from tools.market_data import get_price, get_fundamentals, get_orderbook
- app.py:286-286 (registration)Inclusion of get_orderbook in the tools_map for the Gradio UI toolbox, in the context of MCP-enabled app."Market Data": [get_price, get_fundamentals, get_orderbook],