StockAnalyzer is an AI-powered stock analysis assistant that provides real-time stock data, historical prices, financial statements, and news regarding public companies.
- Real-time Stock Prices: Get current market prices
- Historical Data: Analyze price trends over custom date ranges
- Latest News: Stay updated with company-specific news
- Balance Sheets: Access detailed financial statements
- Conversational Interface: Natural language queries powered by GPT-5
- Streaming Responses: Real-time AI responses
- Conversation Memory: Maintains context across chat sessions
Backend:
- FastAPI → Modern web framework for building APIs
- LangChain → Framework for building LLM applications
- LangGraph → Stateful agent orchestration
- yfinance → Yahoo Finance data retrieval
- OpenAI (via Thesys API) → Gen AI model
Frontend:
- React/Vite
stock-analyzer/
├── backend/
│ ├── main.py # FastAPI app, and routes
│ ├── app/
│ │ ├── agent.py # Agent that stock market data for you
│ │ ├── schemas.py # Pydantic request models
│ │ └── tools.py # Stock-related LangChain tools
│ ├── requirements.txt
│ ├── .env.example
│ └── .env # Environment variables (not committed)
├── frontend/
│ ├── src/
│ │ ├── assets/
│ │ │ └── ...
│ │ ├── App.tsx # Connext frontend to backend API
│ │ └── ...
│ └── ... # Default Frontend files
├── .gitignore
└── README.md
- Python 3.13
- Node.js 24.13 (for frontend)
- Thesys API account
- Create a virtual environment
python -m venv venv
source venv\Scripts\activate # On Linux: venv/bin/activate- Install Python dependencies
pip install -r backend\requirements.txt- Configure API Key
- Sign up at Thesys
- Generate your API key from the dashboard
- Create a
.envfile in the backend directory:
THESYS_API_KEY=<API-KEY-HERE>- Navigate to frontend directory
cd frontend- Install dependencies
npm install# From the project root
python -m uvicorn backend.main:app --reloadThe API will be available at http://localhost:8000
# From the frontend directory
npm run devThe frontend will be available at http://localhost:3000 (or your configured port)
The agent has access to the following tools:
-
get_stock_price - Fetches current stock price
- Input: ticker symbol (e.g., "AAPL")
-
get_historical_stock_price - Retrieves historical price data
- Input: ticker, start_date, end_date (format: YYYY-MM-DD)
-
get_balance_sheet - Gets company balance sheet
- Input: ticker symbol
-
get_stock_news - Fetches latest company news
- Input: ticker symbol
- "What's the current price of Tesla?"
- "Show me Apple's stock performance from January 2024 to March 2024"
- "Get the balance sheet for Microsoft"
- "What's the latest news about NVIDIA?"
- "Compare the prices of GOOGL and META over the last month"
If you encounter file access errors when running the application on Windows, this is likely due to permission restrictions in PowerShell.
Solution: Try running the application from Command Prompt (cmd) instead of PowerShell to resolve the error.
This tool is for informational purposes only. Not financial advice. Always do your own research before making investment decisions.