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
| Name | Required | Description | Default |
|---|---|---|---|
| contract_type | Yes | ||
| symbol | Yes | ||
| exchange | No | SMART | |
| currency | No | USD | |
| what_to_show | No | TRADES |
Implementation Reference
- src/ib_async_mcp/server.py:604-618 (handler)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} - src/ib_async_mcp/server.py:237-251 (registration)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"], }, ),