This AI-powered stock analysis tool is for informational and educational purposes only. It does not constitute financial advice and should not be relied upon for making investment decisions.
- No Guarantees: Stock market investments are inherently risky. The AI-generated insights, predictions, and recommendations may be inaccurate or outdated.
- Not a Financial Advisor: This tool is not a registered financial advisor, brokerage, or investment service.
- Your Responsibility: You are solely responsible for your own financial decisions. The developers and contributors assume no liability for any financial losses or damages incurred from using this tool.
🚨 Always conduct your own research, consult with a qualified financial advisor, and make investment decisions at your own discretion.
Stock AI Bot is a Retrieval-Augmented Generation (RAG) powered AI system that analyzes stock market data, trends, insider trading activity, and news sentiment to provide smart investment insights. It leverages Yahoo Finance, OpenInsider, FAISS vector database, and AI analysis (Ollama LLM) to identify undervalued stocks and provide buy/sell recommendations.
The system comes with a modern web interface built with React, allowing users to input stock tickers and get AI-powered analysis directly in their browser.
✅ Retrieves Historical Stock Data – Fetches stock price history for 7 days, 1 month, 3 months, 6 months, 1 year, and 5 years via Yahoo Finance.
✅ Calculates Technical Indicators – Uses RSI (Relative Strength Index), MACD (Moving Average Convergence Divergence), and SMA (Simple Moving Averages) to analyze stock trends.
✅ Fetches Insider Trading Data – Scrapes OpenInsider to track insider buying/selling trends.
✅ News Sentiment Analysis – Analyzes the latest news sentiment to detect bullish or bearish trends.
✅ RAG-Based AI Predictions – Uses FAISS vector search to retrieve similar stocks and Ollama LLM to provide structured insights:
- Prediction: Uptrend / Downtrend / Neutral
- Confidence Score
- Key Insights (RSI, MACD, Insider Trading, Sentiment)
- Investment Decision (Buy/Sell/Hold)
✅ Web-Based Interface – View stock analysis via a React-based frontend served atlocalhost:3000.
- Python 3.x
- Required Python libraries:
requestsyfinancepandasnumpyflaskfaiss-cpusentence-transformersbs4ollamatextblobscikit-learnpython-dotenv
- Node.js for the React Web Interface
reactrechartsaxiosflask-cors
-
Clone the repository:
git clone https://github.com/Abhinav-ranish/AI-Stock-Algorithm cd AI-Stock-Algorithm -
Install Backend Dependencies:
pip install -r requirements.txt
-
Set up API keys:
- Create a
.envfile in the project root. - Add your NewsAPI key to enable news sentiment analysis:
NEWSAPI_KEY=your_api_key_here
- Create a
-
Install Frontend Dependencies:
cd stock-analyzer-web npm install
- Start the Flask backend:
The backend will be available at:
python stock_ai_bot.py
http://127.0.0.1:5000/
- Start the React web interface:
The frontend will be available at:
cd stock-analyzer-web npm starthttp://127.0.0.1:3000
- Enter a stock ticker in the web app (e.g.,
AAPL,TSLA,NVDA). - Retrieve Data – The backend fetches:
- Yahoo Finance stock history
- RSI, MACD, SMA indicators
- Insider trading from OpenInsider
- News sentiment from NewsAPI
- Retrieves similar stocks via FAISS vector search
- AI-Generated Analysis – The system uses Ollama LLM to predict:
- Trend Prediction (Uptrend, Downtrend, Neutral)
- Confidence Score
- Investment Decision (Buy/Sell/Hold)
- View AI Analysis on the Web Interface.
**Stock:** TSLA
**Prediction:** Uptrend
**Confidence:** 82%
**Key Insights:** Insider buying increased + Positive News Sentiment
**Investment Decision:** BUY
🔹 Enhance AI models to include deep learning-based price forecasting.
🔹 Implement live stock alerts using WebSockets.
🔹 Add Options & Technical Pattern Detection to enhance decision-making.
📜 This project is licensed under the MIT License.
🚀 AI-powered stock analyzer is smarter, retrieves real-time data, and gives AI-based investment decisions – all via a web interface! 🚀