A Next.js dashboard for Uganda Securities Exchange (USE) stocks with real-time data, sentiment analysis, and candlestick charts. Features Real-time Stock Prices: Automatically updated daily from African Financials
# USE Stock Dashboard
A Next.js dashboard for Uganda Securities Exchange (USE) stocks with real-time data, sentiment analysis, and candlestick charts.
## Features
- **Real-time Stock Prices**: Automatically updated daily from African Financials
- **Candlestick Charts**: Interactive charts with daily, weekly, monthly, and yearly views
- **Sentiment Analysis**: AI-powered news sentiment analysis
- **Dividend Tracking**: Track dividend announcements and payments
- **Corporate Actions**: Monitor AGMs, earnings releases, and other corporate events
- **News Articles**: Latest news with sentiment scores
- **Financial Filings**: Latest USE-listed company documents from African Financials
## Data Source
Stock prices and filings are sourced from African Financials
## Daily Updates
The dashboard automatically updates stock prices daily via a cron job:
- **Schedule**: 9:00 AM UTC, Monday through Saturday
- **Endpoint**: `/api/update-prices`
- **Authentication**: Protected with `CRON_SECRET` environment variable
## Setup
1. Install dependencies:
```bash
npm install
```
2. Set environment variables (optional for local development):
```bash
CRON_SECRET=your-secret-key-here
```
3. Run development server:
```bash
npm run dev
```
4. Build for production:
```bash
npm run build
npm start
```
## Deployment
### Vercel (Recommended)
1. Deploy to Vercel:
```bash
vercel
```
2. Set up cron job:
- Go to Vercel Dashboard → Project → Settings → Cron Jobs
- The cron job is configured in `vercel.json`
- Set `CRON_SECRET` environment variable in Vercel dashboard
### Manual Cron Setup
For other hosting platforms, set up a cron job to call:
```
your-domain.com
Authorization: Bearer YOUR_CRON_SECRET
```
Schedule: `0 9 * * 1-6` (9:00 AM UTC, Monday through Saturday)
## API Endpoints
- `GET /api/stocks/[ticker]` - Get stock data for a ticker
- `GET /api/historical/[ticker]?timeframe=daily|weekly|monthly|yearly` - Get historical price data
- `GET /api/updat …