
Explainable AI Trading Agent is a transparent, beginner-friendly trading assistant built on Alpaca's Trading API. Rather than acting as a black-box system, it combines classic technical analysis with AI-generated reasoning so users always understand why a trade decision was made. The agent fetches historical stock price data through Alpaca's Market Data API and applies a Moving Average Crossover strategy (5-day vs 20-day) to generate BUY, SELL, or HOLD signals. Once a signal is generated, Google's Gemini model produces a plain-language explanation of the underlying market logic — describing the trend, the moving average relationship, and what it means for a beginner investor. When a BUY or SELL signal is triggered, the agent automatically places a simulated trade using Alpaca's Paper Trading environment, ensuring zero financial risk while still demonstrating full end-to-end automation. A simple command-line interface lets users enter any stock symbol and instantly see the signal, its AI-generated explanation, and the resulting trade action. This project demonstrates how explainability can be layered onto algorithmic trading systems, making AI-driven finance tools more trustworthy and accessible to non-expert investors.
4 Sep 2026