Agentic-Trading is a simulated trading environment designed around the interaction of autonomous agents. Within this framework, AlphaBot generates potential trade signals while RiskGuard evaluates them for safety and compliance. These agents communicate via the Agent-to-Agent (A2A) protocol, ensuring a standardized exchange of information. A browser-based interface allows users to configure market scenarios, execute simulations, and monitor portfolio performance in real time.
Modular Agent Architecture. The system decomposes complex trading operations into discrete services. AlphaBot implements a simple moving average (SMA) crossover strategy to identify market entries and exits. RiskGuard acts as a gatekeeper, vetting proposed trades against pre-defined risk parameters. Both agents are built using Google’s Agent Development Kit (ADK). The Simulator UI—a FastAPI application—orchestrates the entire process, allowing users to define market conditions and strategy variables before running step-by-step simulations visualized through Plotly.
A2A Communication. Inter-agent messaging is handled by the open A2A specification. This protocol ensures that communication remains structured and interoperable. By following this standard, agents built on differing frameworks can discover one another's capabilities and exchange data securely without custom integration logic.
Configurable Parameters. Users can fine-tune market dynamics, including initial pricing, volatility levels, and directional trends. Strategy settings, such as SMA windows and trade sizing, are also fully adjustable, as are the underlying risk management rules.
Portfolio Tracking. The simulator maintains an accurate ledger of cash reserves, share holdings, and total equity, updating these values immediately after every transaction.
Visual Results. The system provides interactive charts that map price action alongside SMA lines, portfolio equity curves, and specific trade execution markers.
Flexible Deployment. The project includes scripts for both local development and Google Cloud Run deployment. Each service is containerized via its own Dockerfile, and Google Cloud Build is used to streamline the packaging process.
The architecture consists of three primary services communicating over HTTP using the A2A protocol.
tasks/send endpoint. tasks/send endpoint with a trade proposal and the current portfolio state. rules.py. This project utilizes the A2A protocol to bridge the gap between execution logic and risk oversight.
DataPart for structured JSON payloads. agent.json to identify its capabilities and connection endpoints. The ADK simplifies much of this protocol-level complexity.Requirements: Python 3.11 or higher is recommended. The Google Cloud SDK is required for Cloud Run deployments.
git clone https://github.com/kweinmeister/agentic-trading
cd agentic-trading
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
pip install -r requirements.txt
To launch all components simultaneously, use the provided deployment script:
./deploy_local.sh
This script initializes RiskGuard (port 8080 by default), AlphaBot (port 8081), and the Simulator UI (port 8000). Once the services are active, navigate to http://127.0.0.1:8000 in your web browser.
To shut down the services, use the kill command provided in the script output or press Ctrl+C if the processes were started manually.
Install the development dependencies and execute the test suite via pytest:
pip install -r requirements-dev.txt
pytest tests/
The deploy_cloud_run.sh script automates the process of containerizing and deploying all three services to Google Cloud Run.
Before running:
PROJECT_ID or edit the script to include your Google Cloud project ID. gcloud auth login and select your project with gcloud config set project YOUR_PROJECT_ID. Execute the script:
./deploy_cloud_run.sh
The script will establish an Artifact Registry repository if one does not exist. It then uses Cloud Build to create images for RiskGuard, AlphaBot, and the Simulator. Each service is deployed to Cloud Run with the required environment variables—enabling AlphaBot to locate RiskGuard and the Simulator to locate both agents. The final public URL for the Simulator UI will be displayed upon completion.
Security Note: Public deployment renders these services accessible over the open internet. For production environments, it is highly recommended to implement Google Identity-Aware Proxy (IAP) or a similar authentication layer.
Defaults: SMA periods, risk thresholds, simulation parameters, and local service addresses are centrally managed in common/config.py.
Service URLs (Cloud Run): The deployment script automatically configures RISKGUARD_SERVICE_URL and ALPHABOT_SERVICE_URL as environment variables for the relevant services.
PORT Variable: The Dockerfiles and Cloud Run environment utilize the standard PORT environment variable to define the listening port for each service.
AI Trading Simulator: Paper Trade Crypto With Smart LLM Decisions
Kode CLI: A Multi-Model AI Terminal Assistant for Smarter Development
Cline AI Coding Assistant for VS Code: Powered by Claude Sonnet
Yazi: A High-Performance Terminal File Manager Built in Rust
Apple Doc MCP: SwiftUI & UIKit Documentation for Cursor & Claude
Chatterbox TTS API: Open Source Text-to-Speech for Developers
ThinkChain: Stream Claude's Reasoning with Local Tools and MCP
Bolo Blog: A Free Java Blog Engine with Markdown and Dark Mode
Gmail AutoAuth MCP Server: Control Gmail via Claude Desktop
Tabby Terminal: A Cross-Platform Emulator with SSH, Serial Support, and Plugins
Jitsi Meet Review: Open-Source Video Conferencing That Just Works
Perspective: Interactive Data Visualization for the Browser and Python