A real-time backend service that tracks live cryptocurrency token metrics (market cap, velocity), exposes data via REST API and WebSocket, and includes a basic dashboard/UI. The service is containerized using Docker for easy deployment.
- REST API for token metrics with comprehensive endpoints
- WebSocket support for real-time data streaming
- Token velocity calculation using market cap and volume data
- CoinMarketCap API integration for live cryptocurrency data
- SQLite database for data persistence and historical tracking
- API authentication with key-based access control
- Rate limiting and error handling
- Docker containerization for easy deployment
- Real-time visualization of token metrics and velocity
- Interactive charts showing velocity trends and volume correlation
- Live WebSocket updates with connection status indicators
- Responsive design optimized for desktop and mobile
- Token search and filtering capabilities
- Market overview with aggregate statistics
- Modern UI built with React and Tailwind CSS
- Market Capitalization: Real-time market cap data
- Token Velocity: Calculated as volume/market_cap ratio
- 24h Volume: Trading volume over 24 hours
- Price Changes: 1h, 24h, and 7d percentage changes
- Velocity Trends: Historical velocity analysis and trend detection
# Clone the repository
git clone <repository-url>
cd token-metrics-service
# Start all services
docker compose up -d
# Access the application
# Frontend: http://localhost:80
# Backend API: http://localhost:5000cd token-metrics-service
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python src/main.pycd token-metrics-dashboard
pnpm install
pnpm run devInclude API key in request headers:
curl -H "X-API-Key: demo-api-key-12345678" \
http://localhost:5000/api/v1/tokens?limit=10const socket = io("http://localhost:5000", {
auth: { api_key: "demo-api-key-12345678" },
});
socket.emit("subscribe_token", {
token_id: 1,
metrics: ["price", "volume", "velocity"],
});┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend │ │ External │
│ (React) │◄──►│ (Flask) │◄──►│ APIs │
│ Port: 80 │ │ Port: 5000 │ │ (CoinMarketCap)│
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
│ ┌─────────────────┐
│ │ Database │
└──────────────►│ (SQLite) │
│ + Redis Cache │
└─────────────────┘
- Python 3.11 with Flask framework
- Flask-SocketIO for WebSocket support
- SQLAlchemy for database ORM
- Redis for caching (optional)
- Requests for external API integration
- React 19 with modern hooks
- Vite for fast development and building
- Tailwind CSS for styling
- shadcn/ui for UI components
- Recharts for data visualization
- Socket.IO Client for real-time updates
- Docker and Docker Compose for containerization
- Nginx for frontend serving in production
- SQLite for development, PostgreSQL recommended for production
Token velocity is calculated using the formula:
Velocity = 24h Trading Volume / Market Capitalization
This metric indicates how frequently tokens change hands relative to their total market value. Higher velocity suggests more active trading and liquidity.
- Increasing: Rising trading activity relative to market cap
- Decreasing: Declining trading activity or growing market cap
- Stable: Consistent velocity over time
- Configure environment variables for API keys and secrets
- Use Docker Compose for multi-container deployment
- Set up reverse proxy (nginx) for SSL termination
- Configure monitoring and logging
- Implement backup strategy for database
- AWS: ECS/Fargate with ALB
- Google Cloud: Cloud Run with Cloud SQL
- Azure: Container Instances with Azure Database
- DigitalOcean: App Platform or Droplets
- API Key Authentication: All endpoints require valid API keys
- CORS Configuration: Properly configured for cross-origin requests
- Rate Limiting: Prevents API abuse and ensures fair usage
- Environment Variables: Sensitive data stored securely
- Input Validation: All user inputs are validated and sanitized
- Backend:
GET /api/v1/tokens?limit=1 - Frontend: HTTP 200 response from root
- Database: Connection and query performance
- External APIs: CoinMarketCap API status and rate limits
- API response times and error rates
- WebSocket connection counts
- Database query performance
- External API usage and costs
- System resource utilization
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Check the Deployment Guide for detailed setup instructions
- Review the API documentation in the deployment guide
- Open an issue for bugs or feature requests
- Additional Metrics: RSI, MACD, Bollinger Bands
- Historical Data: Extended historical analysis
- Alerts System: Price and velocity alerts
- Portfolio Tracking: Multi-token portfolio analysis
- Advanced Charts: Candlestick and technical indicators
- Mobile App: Native mobile application
- API Webhooks: Push notifications for events