Abot / knowledge-base /Projects /AutonomousTradingAgent.md
anuragbb's picture
Update knowledge-base/Projects/AutonomousTradingAgent.md
fc81fa3 verified

Autonomous Trading Agents

Autonomous Trading Agents is a multi-agent AI system where four independent AI traders β€” each modelled on a legendary investor β€” autonomously research financial news, make portfolio decisions, and execute real stock trades every hour. Built with the OpenAI Agents SDK, MCP (Model Context Protocol), and Gemini 2.5 Flash.

What It Does

Four agents run concurrently using Python asyncio. Each agent reads its current portfolio, calls a Researcher sub-agent to search the web for relevant financial news, checks live stock prices via Polygon.io, and executes buy or sell trades. Every decision and trade is logged to a SQLite database and displayed in a live Gradio dashboard.

The trading is simulated β€” each agent starts with $10,000 β€” but the stock prices are real, sourced from Polygon.io.

The Four Traders

Each agent has a distinct strategy inspired by its namesake investor. Warren follows value investing β€” patient, long-term, focused on fundamentals. George is a macro trader β€” bold and contrarian. Ray is systematic and risk-balanced across asset classes. Cathie focuses on disruptive innovation and crypto ETFs. Agents can also rewrite their own strategy over time using a dedicated tool.

What Makes It Interesting

The system uses a three-tier agent hierarchy β€” an orchestrator coordinates four trader agents, each of which spins up a Researcher sub-agent on demand. MCP servers handle tool access for web search, market data, memory persistence, and push notifications. A custom TracingProcessor hooks into the SDK's internal observability pipeline to surface real-time agent activity in the dashboard. Agents alternate between a trade mode (find new opportunities) and a rebalance mode (review existing holdings) on successive runs, keeping each LLM call focused.

Tech Stack

Python, OpenAI Agents SDK, Gemini 2.5 Flash, MCP, Polygon.io, Tavily, SQLite, LibSQL, Gradio, Plotly, Pydantic.