AI-powered financial & political news sentiment analysis API
sentinews aggregates news from major RSS feeds (Reuters, BBC, NPR, Al Jazeera, TechCrunch, HN), performs real-time sentiment analysis using a financial/political lexicon engine, and serves the results through a clean REST API.
- π Sentiment Analysis Engine β Custom lexicon with 100+ financial & political terms, negation handling, and intensifier support
- π‘ RSS Feed Aggregation β Fetches from 8+ major news sources with deduplication
- π REST API β Hono-powered API with digest, articles, and custom text analysis endpoints
- π» CLI Tool β Terminal-based news digest with color-coded sentiment visualization
- β‘ Built with Bun β Fast startup, fast execution
- π§ͺ Tested β Comprehensive test suite for sentiment engine and caching
# Install dependencies
bun install
# Start the API server
bun run dev
# Or use the CLI
bun run cli digest
bun run cli digest finance 10
bun run cli analyze "Markets surge on peace talks"| Endpoint | Method | Description |
|---|---|---|
/api/v1/health |
GET | Health check |
/api/v1/digest |
GET | News sentiment digest |
/api/v1/articles |
GET | List analyzed articles |
/api/v1/analyze |
POST | Analyze custom text |
/api/v1/cache/stats |
GET | Cache statistics |
/api/v1/cache/clear |
POST | Clear cache |
/api/v1/digest
categoryβ Filter by:politics,finance,tech,generallimitβ Max articles (default: 50, max: 200)refreshβ Force cache refresh:true
/api/v1/articles
categoryβ Filter by categorysentimentβ Filter by:very_negative,negative,neutral,positive,very_positivepageβ Page number (default: 1)limitβ Per page (default: 50)
# Get financial news digest
curl http://localhost:3000/api/v1/digest?category=finance
# Get negative political articles
curl http://localhost:3000/api/v1/articles?category=politics&sentiment=negative
# Analyze custom text
curl -X POST http://localhost:3000/api/v1/analyze \
-H "Content-Type: application/json" \
-d '{"text": "Markets crash amid recession fears"}'Scores range from -1 (very negative) to +1 (very positive):
| Range | Label |
|---|---|
| β€ -0.5 | very_negative |
| -0.5 to -0.15 | negative |
| -0.15 to 0.15 | neutral |
| 0.15 to 0.5 | positive |
| β₯ 0.5 | very_positive |
The engine considers:
- 60+ positive keywords (surge, rally, growth, peace, reform...)
- 60+ negative keywords (crash, recession, war, crisis...)
- Negation (not, never, without...) flips sentiment with dampening
- Intensifiers (very, extremely, slightly...) scale scores
- Title weighting β titles count 60%, content 40%
# Run tests
bun test
# Type check
bun run typecheck
# Build
bun run build- Runtime: Bun
- Framework: Hono (ultrafast web framework)
- Language: TypeScript
- Feed Parser: rss-parser
- Validation: Zod v4
- Testing: Bun built-in test runner
MIT
Built during a late-night dev session π