A real-time stock monitoring dashboard for Pakistan Stock Exchange (PSX) with AI-powered news analysis.
- 8 Watchlist Stocks: PSO, MEBL, UBL, SYS, LUCK, PPL, HBL, MCB
- Composite Scoring: Multi-factor score (0-100) based on P/E, upside, analyst consensus, dividends, ROE, beta
- News Intelligence: Market news with sentiment analysis and per-stock impact scores
- Macro Risk Monitor: Oil crisis, SBP rates, IMF program, Middle East conflict, PKR/USD, monsoon risk
- Shariah Filter: Identify Shariah-compliant stocks (MEBL, SYS, LUCK, PPL)
- Comparison Table: Side-by-side ranking of all stocks
- AI Analysis (optional): Connect your Anthropic API key for live news fetching and impact analysis via Claude
- Position Tracking: Add your holdings with buy price, shares, target sell, and stop loss
- P&L Dashboard: Real-time unrealized gains/losses per position and total
- Sell Signal Engine: thesis-based signals, not daily noise:
- 🚨 Thesis Breaking — stop loss hit or composite score below 50
⚠️ Macro Risk — position exposed to an active high-severity macro risk- 🎯 Analyst Target Reached — price within 5% of consensus target
- ⚖️ Rebalance Needed — position too concentrated (>30%)
- 📈 Good Entry to Add — down more than 10% from entry while score stays 65+
- 100% Private: All data stored in browser localStorage — never leaves your device
- Sample Portfolio: One-click load to test features before adding real positions
# Clone the repo
git clone https://github.com/YOUR_USERNAME/psx-monitor.git
cd psx-monitor
# Install dependencies
npm install
# Run locally
npm run devThe site works with no keys at all. src/config/keyMode.js picks one of:
| Mode | When | Where analysis comes from |
|---|---|---|
demo (default) |
no key anywhere | public/data/ai-snapshot.json (seeded snapshot, labelled in the header) |
byok |
a visitor saves their own key in AI settings (gear icon) | /api/claude with the key in the x-anthropic-key header; key kept in this browser's localStorage only |
server |
VITE_AI_MODE=server and ANTHROPIC_API_KEY set on the deployment |
/api/claude with the server key, for signed-in users |
Live calls use claude-opus-5-5 with the web_search_20260209 tool. If a live call fails, the panels fall back to the snapshot.
To refresh the demo snapshot with a real run (costs API credits):
ANTHROPIC_API_KEY=sk-ant-... node scripts/build-ai-snapshot.mjsPortfolio data lives in localStorage by default. Set VITE_SUPABASE_URL / VITE_SUPABASE_ANON_KEY to enable sign-in and cross-device sync (src/store/portfolioStore.js).
npm i -g vercel
vercel- Push to GitHub:
git init git add . git commit -m "PSX Monitor v1" git branch -M main git remote add origin https://github.com/YOUR_USERNAME/psx-monitor.git git push -u origin main
- Go to https://vercel.com/new
- Import your GitHub repo
- Optionally add
ANTHROPIC_API_KEY+VITE_AI_MODE=server(live news) and Supabase vars (sync) - Deploy — done!
Vercel auto-deploys on every push to main.
# Install gh-pages
npm install --save-dev gh-pages
# Add to package.json scripts:
# "deploy": "npm run build && gh-pages -d dist"
# In vite.config.js, add:
# base: '/psx-monitor/',
npm run deploypsx-monitor/
├── src/
│ ├── main.jsx # Entry point
│ ├── App.jsx # Main dashboard + portfolio UI
│ ├── data.js # Stock data, macro factors, scoring
│ ├── news.js # News module with AI analysis
│ └── portfolio.js # Portfolio tracking, P&L, sell signals
├── index.html
├── package.json
├── vite.config.js
├── vercel.json
├── .env.example
└── README.md
Add more stocks: Edit WATCHLIST_STOCKS in src/data.js
Add macro factors: Edit MACRO_FACTORS in src/data.js
Add news sources: Edit NEWS_SOURCES and FALLBACK_NEWS in src/news.js
Custom scoring: Modify computeScore() in src/data.js
Stock data: Analyst estimates from PSX, Investing.com, SCS Trade (mid-March 2026) News: Curated from Business Recorder, Dawn, Reuters, The News International Macro: IMF, SBP, NDMA, Trading Economics
This is for informational and educational purposes only — not financial advice. Always consult a SECP-registered broker before making investment decisions. Past performance does not guarantee future results.
MIT