PythonOpenAI Agents SDKIBKR API

Agentic Trader

Autonomous market analysis and execution.

Overview

AI trading agents that research, assess risk, and execute trades using OpenAI Agents SDK.

Problem

Wanted to explore the practical implementation of agentic AI in market analysis and trade execution. Trading requires real-time data synthesis, risk assessment, and multi-step reasoning.

Constraints

Market data APIs require robust error handling and rate limit management. System design must include fail-safes for unexpected agent behavior and network interruptions. Paper trading only—no real capital.

Approach

  • Built custom tool set for fetching market data from IBKR and Polygon.io, analyzing portfolios, and executing orders
  • Implemented hard constraints such as maximum position size, stop-loss triggers, and portfolio concentration limits
  • Used OpenAI's structured outputs to require agent responses to follow validated schemas
  • Stored decision logs locally with agent reasoning and tool calls for post-trade review

Result

Agent demonstrated coherent multi-step reasoning from initial research to execution in a paper trading environment. The project provided insights into the guardrails and data requirements needed for agentic systems in high-risk domains.

What I'd Do Next

Add backtesting framework using historical data. Implement agent 'sleep mode' during low-liquidity periods. Explore multi-agent architecture for specialized research and execution roles.