Skip to main content
Glama
nadavgb-atom

ib-async-mcp

by nadavgb-atom

get_market_data

Retrieve real-time market data snapshots for financial contracts to monitor current prices and market conditions.

Instructions

Get real-time market data snapshot for a contract.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_typeYes
symbolYes
exchangeNoSMART
currencyNoUSD

Implementation Reference

  • Handler for 'get_market_data' tool which requests market data for a contract using ib_async and returns a dictionary of ticker values.
    if name == "get_market_data":
        contract = create_contract(
            args["contract_type"],
            symbol=args["symbol"],
            exchange=args.get("exchange", "SMART"),
            currency=args.get("currency", "USD"),
        )
        await ib.qualifyContractsAsync(contract)
        tickers = await ib.reqTickersAsync(contract)
        if tickers:
            t = tickers[0]
            return {
                "symbol": contract.symbol,
                "bid": t.bid,
                "ask": t.ask,
                "last": t.last,
                "volume": t.volume,
                "open": t.open,
                "high": t.high,
                "low": t.low,
                "close": t.close,
            }
        return {"error": "No data available"}
  • Definition and input schema for the 'get_market_data' tool.
    Tool(
        name="get_market_data",
        description="Get real-time market data snapshot for a contract.",
        inputSchema={
            "type": "object",
            "properties": {
                "contract_type": {"type": "string"},
                "symbol": {"type": "string"},
                "exchange": {"type": "string", "default": "SMART"},
                "currency": {"type": "string", "default": "USD"},
            },
            "required": ["contract_type", "symbol"],
        },
    ),

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nadavgb-atom/ib-async-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server