Your portfolio tracker now has AI-powered features and advanced stock analysis! Here's the complete guide.
Groq provides free access to Llama 3.1 70B and Mixtral models with very fast inference.
Features enabled:
- Portfolio analysis & recommendations
- Stock analysis
- AI Chat assistant
Setup:
- Go to https://console.groq.com/keys
- Sign up (free)
- Create an API key
- Add to
backend/.env:GROQ_API_KEY=your-groq-api-key-here
If you have Perplexity Pro subscription, you can use their API for real-time news.
Features enabled:
- Real-time stock news
- Market sentiment analysis
Setup:
- Go to https://www.perplexity.ai/settings/api
- Generate an API key
- Add to
backend/.env:PERPLEXITY_API_KEY=your-perplexity-api-key-here
- Ask questions about your portfolio
- Get stock recommendations
- Market insights
- Requires: Groq API
- Portfolio risk analysis
- Sector allocation insights
- Personalized recommendations
- Works without API (rule-based fallback)
- AI-generated stock analysis
- Key insights and outlook
- Requires: Groq API
- Real-time news for any stock
- Source citations
- Requires: Perplexity API
The app still works without API keys:
- Portfolio analysis uses rule-based calculations
- Risk scores and recommendations are generated locally
- News and chat features show "API required" messages
- Real Fundamentals: P/E, ROE, debt ratios from Yahoo Finance
- Fair Value Estimate: Like SimplyWall.St - shows if stock is undervalued/overvalued
- Health Scores Radar: Snowflake chart showing Value, Growth, Health, Dividend scores
- Investment Checklist: Auto-calculated checks based on fundamentals
- Stock Comparison: Compare multiple stocks on same chart
- Price Alerts: Set alerts for price targets (stored locally)
- Improved Charts: Smoother animations, better date formatting
- Analytics Tab: Sector allocation, risk assessment, diversification score
- Returns Tab: Real P&L calculations, CAGR estimates, top contributors
- Dividends Tab: Track dividend income, yield analysis
- Discover Tab: Stock screener with preset filters
- Mini Charts: Sparkline charts in holdings table
- Market Status: Live market open/closed indicator
- Top Movers: Real gainers/losers from database
- Sector Allocation: Pie chart of your holdings by sector
- AI Insights: Portfolio recommendations
- Caches live prices with 30s TTL
- Batch fetching for multiple tickers
- Fallback to individual requests
- Fetches from Yahoo Finance API
- Fair value calculation
- Health score computation
POST /api/stocks/live- Batch live pricesGET /api/stocks/<ticker>/fundamentals- Detailed fundamentalsGET /api/stocks/<ticker>/spark- Sparkline dataGET /api/stocks/<ticker>/dividends- Dividend infoGET /api/stocks/movers- Top gainers/losers
After adding API keys, restart the backend:
cd backend
python app.pyThen test the AI status endpoint:
GET http://localhost:5000/api/ai/status
Should return:
{
"groq_available": true,
"perplexity_available": true,
"features": {
"portfolio_analysis": true,
"stock_analysis": true,
"news": true,
"chat": true,
"market_sentiment": true
}
}Test fundamentals endpoint:
GET http://localhost:5000/api/stocks/RELIANCE/fundamentals
- SimplyWall.St - Fair value, health scores
- TickerTape - Stock screener
- Yahoo Finance - Fundamentals data
- IndMoney - Portfolio analytics