Skip to content

trading_agent.tools.get_time_tool

A tool that tells the model the current date and time in India.

Models do not know the time, and a trading desk needs it for nearly every decision, so this is the first tool.

Typical usage example:

result = await GetTimeTool().run(NoArguments())

GetTimeTool

Bases: Tool

Returns the current date, weekday and time in India.

run async

run(arguments)

Reads the clock.

Parameters:

Name Type Description Default
arguments NoArguments

No arguments.

required

Returns:

Type Description
ToolResult

For example "Friday 2026-10-16 10:15:03 IST (UTC+05:30)".

Source code in src/trading_agent/tools/get_time_tool.py
async def run(self, arguments: tool.NoArguments) -> tool.ToolResult:
    """Reads the clock.

    Args:
        arguments (tool.NoArguments): No arguments.

    Returns:
        tool.ToolResult: For example "Friday 2026-10-16 10:15:03 IST (UTC+05:30)".
    """
    del arguments
    now = datetime.datetime.now(_INDIA)
    return tool.ToolResult.success(
        now.strftime('%A %Y-%m-%d %H:%M:%S IST (UTC+05:30)')
    )