Skip to main content
Glama
nadavgb-atom

ib-async-mcp

by nadavgb-atom

get_head_timestamp

Retrieve the earliest available historical data timestamp for a specified financial instrument from Interactive Brokers. Use this tool to determine the starting point for historical market data queries.

Instructions

Get earliest available historical data timestamp.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_typeYes
symbolYes
exchangeNoSMART
currencyNoUSD
what_to_showNoTRADES

Implementation Reference

  • The _handle_tool function routes to the 'get_head_timestamp' block which sets up the contract, qualifies it, and calls reqHeadTimeStampAsync.
    if name == "get_head_timestamp":
        contract = create_contract(
            args["contract_type"],
            symbol=args["symbol"],
            exchange=args.get("exchange", "SMART"),
            currency=args.get("currency", "USD"),
        )
        await ib.qualifyContractsAsync(contract)
        ts = await ib.reqHeadTimeStampAsync(
            contract,
            whatToShow=args.get("what_to_show", "TRADES"),
            useRTH=True,
            formatDate=1,
        )
        return {"head_timestamp": ts.isoformat() if ts else None}
  • The tool 'get_head_timestamp' is registered in the list of available tools with its input schema.
    Tool(
        name="get_head_timestamp",
        description="Get earliest available historical data timestamp.",
        inputSchema={
            "type": "object",
            "properties": {
                "contract_type": {"type": "string"},
                "symbol": {"type": "string"},
                "exchange": {"type": "string", "default": "SMART"},
                "currency": {"type": "string", "default": "USD"},
                "what_to_show": {"type": "string", "default": "TRADES"},
            },
            "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