morid648

AI Stock Analyst — Data skill for Claude Code

Data community

Turn a plain-English request ("compare Apple and Microsoft YTD") into a validated stock chart — a CrewAI multi-agent pipeline exposed as MCP tools for Claude Desktop/Code, using yfinance data, AST-val.

How to install AI Stock Analyst

This entry records only its repository, not the path inside it, so there is no exact command to give. Open morid648/ai-stock-analyst and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What AI Stock Analyst does

Turn a plain-English request ("compare Apple and Microsoft YTD") into a validated stock chart — a CrewAI multi-agent pipeline exposed as MCP tools for Claude Desktop/Code, using yfinance data, AST-validated code generation, and sandboxed execution. Runs on local (Ollama/DeepSeek-R1) or cloud (Groq, GPT-4o) LLMs.

Alternatives in Data

  • A Stock Data — A股全栈数据工具包 · 十一层架构 · 54端点 · 19数据源 · 零鉴权 Full-stack China A-share data toolkit for AI agents — 11 layers, 54 end 9.4k ★
  • HTML Video — Programmatic video for coding agents — HTML to video on your laptop 4.5k ★
  • MCP Server Chart — 🤖 A visualization mcp & skills contains 25+ visual charts using @antvis 4k ★

README

AI Financial Analyst Agent

Autonomous multi-agent stock research and visualization engine powered by **CrewAI**, **FastMCP**, **yfinance**, and local open-weight LLMs (**DeepSeek-R1 / Ollama**).

[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![FastMCP](https://img.shields.io/badge/MCP-FastMCP-green.svg)](https://modelcontextprotocol.io/) [![CrewAI](https://img.shields.io/badge/CrewAI-Agents-orange.svg)](https://crewai.com)


1. Overview

Retrieving, analyzing, and visualizing stock market data usually requires manually writing Python scripts, juggling `yfinance` and `matplotlib` parameters, and debugging code execution.

The **AI Financial Analyst Agent** accepts natural language queries (such as *"Show me Tesla's YTD performance"* or *"Compare Apple and Microsoft stocks for the past year"*) and autonomously:

  1. Parses ticker symbols, timeframes, and actions into structured Pydantic schemas.
  2. Generates clean, production-ready Python visualization scripts using yfinance and matplotlib.
  3. Validates & executes the generated code in a sandboxed subprocess with strict timeouts and error handling.
  4. Exposes the entire pipeline as standard MCP (Model Context Protocol) tools ready for Claude Desktop and Claude Code.

2. Architecture

flowchart TD
    User([User Prompt / MCP Client]) -->|Tool Call: analyze_stock| Server[FastMCP Server: server.py]
    Server -->|Kickoff| Crew[CrewAI Pipeline: finance_crew.py]

    subgraph CrewAI Sequential Process
        A1[Agent 1: Stock Data Analyst] -->|Structured Query Analysis| A2[Agent 2: Senior Python Developer]
        A2 -->|Draft Python Script| A3[Agent 3: Senior Code Execution Expert]
        A3 -->|Review & Self-Correction Loop| A2
    end

    Crew -->|Raw Output| Sanitizer[Output Sanitizer: utils/sanitize