All projects

Anomaly Detection & Explanation Agent

A self-directed project, not a real client engagement, using real market data from Yahoo Finance's live AAPL feed. Built to statistically flag unusual price moves and explain each one in plain English via an LLM.

PythonpandasyfinanceSQLiteGemini APIStreamlitPlotlyClaude Code

Live Dashboard

Having trouble interacting with the embed? Click here to open the full app in its own page →

KPIs

23
Anomalies Detected (2 Yrs, AAPL)
-9.25%
Largest Single-Day Move (Z-Score -4.58)
~22 days
Average Gap Between Flagged Events

Project overview

Analysts and investors have to manually scan charts to catch abnormal price action. This tool flags statistically rare movements automatically and surfaces them with context, so the question shifts from "did anything unusual happen?" to "here's what happened, and here's what to check next."

Methodology

01

Detect

Rolling 20-day mean and standard deviation of daily % price change; a day is flagged when it falls beyond a 2.5 standard deviation threshold from its own recent trailing behavior, not a fixed % cutoff, so the model adapts to each stock's normal volatility.

02

Explain

Each flagged anomaly is sent to Google Gemini with statistical context (z-score, % change, day of week), generating a short explanation plus a suggested next step for investigation.

03

Auto-refresh

The dashboard checks for new trading days on each visit (capped hourly) and automatically explains any newly-flagged anomaly.

Findings

Recommendations

The data pipeline, detection logic, and dashboard are fully built and live. Where I'm still stuck: the AI-explanation layer fails intermittently once deployed, and I'm working through Streamlit's live logs to track down why before I call it done. Next on my list: upgrading to Gemini's Google Search grounding so the explanations can point to real news events instead of just statistical context, once I get billing set up for it.

What this demonstrates

Next up

E-Commerce Profitability Analysis

View next project →