A real-time cryptocurrency news aggregator that collects articles from various sources, performs sentiment analysis, and provides insights into market trends.
- News Collection: Fetches cryptocurrency news from multiple sources using NewsAPI
- Sentiment Analysis: Analyzes article sentiment using TextBlob's NLP capabilities
- Trend Analysis: Tracks sentiment trends over time
- RESTful API: FastAPI-based endpoints for accessing news and analysis
- Background Processing: Celery workers for async task processing
- Containerized: Docker Compose setup for easy deployment
- Backend: Python 3.9+, FastAPI
- Database: PostgreSQL
- Cache & Message Broker: Redis
- Task Queue: Celery
- NLP: TextBlob
- Containerization: Docker, Docker Compose
- Docker and Docker Compose
- Python 3.9+
- Poetry (for local development)
- NewsAPI key
- Copy the example environment file:
cp .env.example .env
- Update the
.envfile with your configuration:NEWS_API_KEY=your_newsapi_key DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/crypto_news CELERY_BROKER_URL=redis://localhost:6379/0 CELERY_RESULT_BACKEND=redis://localhost:6379/0
docker-compose up -dThis will start:
- FastAPI app on http://localhost:8000
- PostgreSQL database
- Redis server
- Celery worker
- Celery beat (for scheduled tasks)
-
Install dependencies:
poetry install
-
Run database migrations:
alembic upgrade head
-
Start the development server:
uvicorn crypto_news_aggregator.main:app --reload
-
Start Celery worker:
celery -A crypto_news_aggregator.tasks worker --loglevel=info
Once the application is running, you can access:
- API Docs: http://localhost:8000/docs
- Redoc: http://localhost:8000/redoc
Run unit tests:
pytest tests/Run integration tests:
pytest tests/integration/├── src/
│ └── crypto_news_aggregator/
│ ├── api/ # API endpoints
│ ├── core/ # Core functionality
│ ├── db/ # Database models and migrations
│ ├── tasks/ # Celery tasks
│ └── main.py # FastAPI application
├── tests/ # Test files
├── scripts/ # Utility scripts
├── docker-compose.yml # Docker Compose configuration
└── pyproject.toml # Project metadata and dependencies
- Test individual components in isolation
- Mock external dependencies
- Fast execution
- Example:
test_sentiment_analyzer.py
- Test interactions between components
- Use real database and services
- Slower but more realistic
- Example:
test_sentiment_pipeline.py
This project and all its contents are Copyright © 2025 Michael Lee Chavez. All rights reserved.
All rights reserved. No part of this project may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the copyright owner.
For permission requests, please contact the author.