A complete end-to-end web application that combines Generative AI and Agentic AI to help users analyze stocks, manage investments, and make intelligent financial decisions.
- Full conversational AI chatbot with natural language understanding
- Multi-agent system for comprehensive financial analysis
- Real-time responses with explainable AI reasoning
- Quick action buttons for common queries
- Chat history with timestamps
- User input: Stock symbol + time period
- Real-time price data and historical charts
- Technical indicators (SMA 20, SMA 50, P/E ratio)
- 52-week high/low, volume, market cap
- Trend analysis (bullish/bearish)
- User input: Stock symbol
- 7-day ML-powered predictions with confidence scores
- Historical vs predicted price charts
- Model accuracy metrics
- Detailed prediction table
- User input: Stock symbol
- Latest financial news articles
- AI-powered sentiment analysis (positive/negative/neutral)
- Sentiment score visualization
- Article summaries with sources
- User input: Budget + risk level (low/medium/high)
- AI-optimized portfolio allocation
- Interactive pie charts
- Stock breakdown with shares and amounts
- Expected returns and risk analysis
- Personalized recommendations
- Overview of all features in one place
- Live market data
- Quick access to all tools
- Data Agent: Fetches real-time and historical stock data from Yahoo Finance
- News Agent: Analyzes news sentiment (positive/negative/neutral)
- Prediction Agent: ML-powered price forecasting using LSTM/regression
- Decision Agent: Aggregates all data to generate final recommendations
- Natural language queries: "Which stocks should I buy?", "Why is TCS falling?"
- LLM-powered intent detection and task decomposition
- Explainable AI with reasoning for every recommendation
- Real-time stock market data with interactive charts
- Price prediction visualization (predicted vs actual)
- News sentiment analysis with visual indicators
- Portfolio management with allocation charts
- Autonomous alerts and notifications
- Interactive line charts (stock trends)
- Area charts with gradients
- Pie charts (portfolio allocation)
- Candlestick charts support
- Real-time updates
- Framework: FastAPI
- AI/ML: LangChain, OpenAI API, scikit-learn
- Data: Yahoo Finance API, NewsAPI
- Sentiment Analysis: TextBlob
- Framework: React 18 with Vite
- Styling: Tailwind CSS
- Charts: Recharts
- Animations: Framer Motion
- Icons: Lucide React
- Notifications: React Hot Toast
- Python 3.9+
- Node.js 18+
- npm or yarn
- Navigate to backend directory:
cd backend- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Create
.envfile:
cp .env.example .env- Add your API keys to
.env:
OPENAI_API_KEY=your-openai-api-key
NEWS_API_KEY=your-news-api-key
- Run the backend:
python app.pyBackend will run on http://localhost:8000
- Navigate to frontend directory:
cd frontend- Install dependencies:
npm install- Run the development server:
npm run devFrontend will run on http://localhost:3000
- Open your browser and navigate to
http://localhost:3000 - The dashboard will load with demo data
- Use the chat panel to ask questions:
- "Which stocks should I buy?"
- "Predict AAPL price for next week"
- "Create a portfolio with βΉ50,000 budget"
- "Why is TCS falling?"
- Click on stock symbols to view detailed analysis
- Explore portfolio allocation and performance charts
- Check alerts for buy/sell opportunities
POST /api/chat- Send message to AI assistant
GET /api/stocks/{symbol}- Get stock dataGET /api/stocks/{symbol}/prediction- Get price predictions
GET /api/news/{symbol}- Get news with sentiment analysis
POST /api/portfolio/create- Create optimized portfolioGET /api/portfolio/{user_id}- Get user portfolio
GET /api/alerts/{user_id}- Get user alerts
GET /api/market/overview- Get market overview
ai-financial-copilot/
βββ backend/
β βββ agents/
β β βββ data_agent.py # Stock data fetching
β β βββ news_agent.py # News sentiment analysis
β β βββ prediction_agent.py # Price prediction ML
β β βββ decision_agent.py # Final recommendations
β β βββ orchestrator.py # Multi-agent coordination
β βββ services/
β β βββ stock_service.py
β β βββ news_service.py
β β βββ prediction_service.py
β β βββ portfolio_service.py
β βββ database/
β β βββ db.py # Simple file-based DB
β βββ app.py # FastAPI application
β βββ requirements.txt
β βββ .env.example
βββ frontend/
β βββ src/
β β βββ components/
β β β βββ Header.jsx
β β β βββ ChatPanel.jsx
β β β βββ StockDashboard.jsx
β β β βββ PredictionPanel.jsx
β β β βββ NewsPanel.jsx
β β β βββ PortfolioPanel.jsx
β β β βββ AlertsPanel.jsx
β β βββ services/
β β β βββ api.js
β β βββ App.jsx
β β βββ main.jsx
β β βββ index.css
β βββ package.json
β βββ vite.config.js
β βββ tailwind.config.js
β βββ index.html
βββ README.md
Every recommendation includes:
- Technical analysis signals
- Sentiment analysis results
- Prediction model insights
- Risk assessment
- Confidence levels
- Stores user preferences (risk level, budget)
- Personalizes responses based on history
- Remembers favorite stocks
- Price change notifications
- Buy/sell opportunity detection
- News-based alerts
- Portfolio performance updates
The application includes fallback demo data for:
- Stock prices and historical data
- News articles with sentiment
- Price predictions
- Portfolio allocations
This ensures the app works even without API keys for demonstration purposes.
Get your key from: https://platform.openai.com/api-keys
Get your key from: https://newsapi.org/register
Note: The app works with demo data if API keys are not provided.
cd backend
uvicorn app:app --reload --host 0.0.0.0 --port 8000cd frontend
npm run devcd frontend
npm run build- Ensure Python 3.9+ is installed
- Check if all dependencies are installed:
pip list - Verify API keys in
.envfile - Check if port 8000 is available
- Clear node_modules and reinstall:
rm -rf node_modules && npm install - Check if port 3000 is available
- Verify backend is running on port 8000
- Backend includes CORS middleware for localhost:3000
- If using different port, update CORS settings in
backend/app.py
- Real-time WebSocket updates
- Advanced ML models (LSTM, Transformer)
- Social trading features
- Mobile app (React Native)
- Advanced portfolio optimization
- Backtesting capabilities
- Multi-currency support
- Integration with trading platforms
MIT License - feel free to use this project for learning and development.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and questions, please open an issue on GitHub.