Skip to content

thinkshake/sentinews

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“° sentinews

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.

Features

  • πŸ” 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

Quick Start

# 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"

API Endpoints

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

Query Parameters

/api/v1/digest

  • category β€” Filter by: politics, finance, tech, general
  • limit β€” Max articles (default: 50, max: 200)
  • refresh β€” Force cache refresh: true

/api/v1/articles

  • category β€” Filter by category
  • sentiment β€” Filter by: very_negative, negative, neutral, positive, very_positive
  • page β€” Page number (default: 1)
  • limit β€” Per page (default: 50)

Examples

# 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"}'

Sentiment Scoring

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%

Development

# Run tests
bun test

# Type check
bun run typecheck

# Build
bun run build

Tech Stack

  • Runtime: Bun
  • Framework: Hono (ultrafast web framework)
  • Language: TypeScript
  • Feed Parser: rss-parser
  • Validation: Zod v4
  • Testing: Bun built-in test runner

License

MIT


Built during a late-night dev session πŸŒ™

About

πŸ“° AI-powered financial & political news sentiment analysis API β€” Built with Bun + Hono + TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors