Inspiration
The inspiration for AutoTradePilot was forged in the frustrating reality of our own trading journeys. Like many traders, we knew the theory—we could analyze charts, read market news, and devise what we thought were solid strategies. But when it was time to execute, we were our own worst enemies.
We fell into every classic trap: the panic-sell during a dip that soon recovered, the FOMO-driven buy at a peak, and the analysis paralysis that led to missed opportunities. Our decisions were often clouded by emotion, cognitive biases, and the sheer mental exhaustion of trying to track multiple data points at once. We were inspired to build a solution that could embody the discipline we struggled to maintain: a system that operated on pure logic, free from fear and greed.
What it does
AutoTradePilot is a sophisticated, automated trading system that acts as a digital trading desk. At its core, it takes a simple, plain-English query from a user, such as "What's the trading signal for AAPL today?", and orchestrates a team of specialized AI agents to provide a comprehensive, data-driven answer.
The system systematically performs:
Intent & Entity Recognition: It first understands what the user is asking for and which financial asset they are targeting.
Multi-Factor Market Analysis: It dispatches agents to simultaneously analyze the asset from multiple angles: news sentiment analysis, technical indicator calculations (RSI, Bollinger Bands, etc.), and chart pattern identification.
Synthesized Decision Making: It consolidates all the analysis from the specialist agents and uses a core "decision" agent to weigh the evidence, apply a predefined trading strategy, and generate a final trading signal (BUY, SELL, or HOLD), complete with a rationale.
Order Execution: If a signal is generated, the system can formulate and submit an actual trade order to a brokerage (like Alpaca) via API.
In short, it automates the entire analytical and decision-making workflow of a disciplined trader.
How we built it
We built AutoTradePilot using a modular, multi-agent architecture on the Google Agent Development Kit (ADK) and Google Cloud Platform. This allowed us to treat each step of the trading workflow as a distinct, specialist agent.
The "Team" Structure:
AutoTradePilotConductor: The orchestrator that manages the workflow.
QueryUnderstandingAgent: Uses a Gemini LLM to interpret user requests.
NewsSentimentAgent: Uses an LLM and the NewsAPI.org service for sentiment analysis.
TechnicalIndicatorAgent & ChartPatternAgent: Pure Python agents using libraries like pandas and pandas_ta to perform quantitative analysis on price data from the Alpaca Markets API.
TradingDecisionAgent: The "brain" that synthesizes all the data to produce a trading signal.
Technology Stack:
Framework: Google Agent Development Kit (ADK)
Language: Python
LLM Backend: Google Vertex AI (Gemini Models)
APIs: Alpaca Markets (Trading & Data), NewsAPI.org (News)
Data Processing: pandas, numpy, scipy
The agents communicate by passing structured JSON data through a shared state manager (session.state), ensuring a clean and auditable flow of information from one step to the next.
Challenges we ran into
LLM Reliability: A major hurdle was prompt engineering the LLM-based agents to ensure they consistently returned valid, properly formatted JSON. We had to build utility functions specifically to clean and validate their output before it could be used by other parts of the system.
Environment and Authentication: Setting up the project to run both locally and be ready for cloud deployment was complex. Managing Python dependencies, environment variables, and authenticating with Google Cloud and multiple external APIs required meticulous configuration. We hit a particularly tough wall with SSL certificate errors on a corporate network, which required a deep dive into SSL certificate bundling.
Synthesizing Conflicting Signals: The hardest conceptual challenge was programming the TradingDecisionAgent. Defining the logic to weigh conflicting signals—for example, when technicals suggest "BUY" but news sentiment is negative—is the core of any trading strategy and required significant iteration.
Accomplishments that we're proud of
Building a Functional Multi-Agent System: We successfully designed and implemented a complex system where multiple specialized agents collaborate to achieve a common goal. The architecture is robust, modular, and scalable.
Intelligent Integration of AI and Code: We're proud of how we leveraged LLMs for what they do best (language understanding, summarization) while relying on deterministic Python code for quantitative analysis. This hybrid approach created a reliable and powerful system.
Creating an End-to-End Solution: We built a complete, end-to-end workflow that goes from a simple human question to a fully reasoned, machine-driven trading decision. It’s not just a collection of scripts, but a cohesive, intelligent system.
Engineering Real Discipline: Most importantly, we succeeded in our original mission. We built a system that externalizes trading logic, effectively removing human emotion and bias from the execution process and enforcing a disciplined strategy.
What we learned
The Power of Delegation: A multi-agent architecture is a profoundly effective way to tackle complex problems. Breaking the system into specialized, single-responsibility agents made debugging, testing, and upgrading individual components immensely easier.
LLMs are Reasoning Engines, Not Calculators: We learned to use Large Language Models for their strengths in unstructured data and inference, while using traditional code for tasks requiring precision and mathematical accuracy. The real power emerged from combining these two worlds.
Discipline Can Be Engineered: Our initial hypothesis was proven correct. By externalizing the decision-making process to an automated, unemotional system, we effectively built "discipline-as-a-service," ensuring that our strategy is followed, not our fleeting emotions.
What's next for AutoTradePilot: Automated Multi-Agent Trading System
This is just the beginning. Our roadmap is focused on evolving AutoTradePilot from a signal generator into a full-fledged portfolio management system.
Strategy Refinement: Implement more sophisticated trading strategies and allow for dynamic strategy selection.
Advanced Risk Management: Integrate dynamic position sizing, ATR-based stop-losses, and portfolio-level risk controls.
Portfolio & Trade Management: Add new agents dedicated to tracking open positions, calculating PnL, and managing active trades with features like trailing stops.
Enhanced Data Sources: Integrate more robust, low-latency market data and news feeds to improve decision quality.
Full Deployment & Operation: Deploy the system to Google Kubernetes Engine (GKE) for scalable, 24/7, reliable operation.
Robust Backtesting Framework: Build an integrated framework to rigorously test new strategies against historical data.
Built With
- adk
- agent
- ai
- alpaca
- alpaca-trade-api
- api
- cloud
- compute
- development
- engine
- firestore
- gce
- gcp
- git
- gke
- google-cloud-aiplatform
- google-cloud-aiplatform-web-&-environment:-uvicorn
- kit
- kubernetes
- manager
- markets
- newsapi-python
- newsapi.org
- numpy
- pandas
- pandas-ta
- platform
- python
- python-dotenv
- scipy
- scipy-api-clients:-alpaca-trade-api
- secret
- uvicorn
- vertex
Log in or sign up for Devpost to join the conversation.