δΈζηζ¬ | English
A comprehensive web application for managing multi-chain cryptocurrency assets with real-time price monitoring and portfolio management capabilities.
- π Multi-Chain Support: Ethereum, Arbitrum, Base, Polygon, BSC, Solana, Sui, Bitcoin
- π° Real-Time Pricing: Integrated with CoinGecko API for live token prices
- π Asset Management: Add, view, and delete cryptocurrency assets
- π·οΈ Tagging System: Custom tags for asset categorization and management
- π Historical Data: Track asset value changes over time
- π Performance Optimized: Smart caching and batch queries to reduce API calls
- π± Responsive Design: Mobile-first, modern user interface
- π Auto-Refresh: Real-time portfolio updates
- Ethereum (ETH) - Ethereum Mainnet
- Arbitrum One (ETH) - Ethereum L2 Scaling Network
- Base (ETH) - Coinbase's L2 Network
- Polygon (MATIC) - Polygon Mainnet
- BNB Smart Chain (BNB) - Binance Smart Chain
- Solana (SOL) - Solana Mainnet
- Sui (SUI) - Sui Mainnet
- Bitcoin (BTC) - Bitcoin Mainnet
- Language: Python 3.9+
- Framework: FastAPI
- Package Manager: uv
- Blockchain: web3.py, httpx (multi-chain support)
- Price Data: CoinGecko API
- Database: SQLite with aiosqlite
- Async: asyncio, aiohttp
- Technology: Pure HTML5, CSS3, JavaScript (ES6+)
- Design: Responsive, mobile-first approach
- UI/UX: Modern, intuitive interface
- Python 3.9 or higher
- uv (Python package manager)
- Modern web browser
- Internet connection for price data
-
Clone the repository
git clone git@github.com:scdotbox/crypto_asset.git cd Cryptocurrency_Asset_Manager -
Quick Start (Recommended)
# Automatically clean ports and start all services ./start_project.sh -
Manual Setup
# Backend setup cd backend uv venv source .venv/bin/activate # Linux/Mac # or .venv\Scripts\activate # Windows uv pip install -e . # Start backend uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8010 # Frontend setup (new terminal) cd frontend python -m http.server 8020
- π¨ Frontend Interface: http://localhost:8020
- π‘ API Documentation: http://localhost:8010/docs
- π ReDoc Documentation: http://localhost:8010/redoc
- π API Root: http://localhost:8010
Cryptocurrency_Asset_Manager/
βββ backend/ # Backend API service
β βββ app/
β β βββ core/ # Core configurations and utilities
β β βββ models/ # Data models and schemas
β β βββ routers/ # API route handlers
β β βββ services/ # Business logic services
β β βββ main.py # FastAPI application entry point
β βββ data/ # Database and data files
β βββ pyproject.toml # Python project configuration
β βββ requirements.txt # Python dependencies
βββ frontend/ # Frontend web interface
β βββ css/ # Stylesheets
β βββ js/ # JavaScript modules
β β βββ modules/ # Modular JS components
β βββ index.html # Main HTML file
βββ data/ # Application data and backups
β βββ backup_*/ # Database backups
β βββ history/ # Historical data
βββ docs/ # Documentation
βββ logs/ # Application logs
βββ tests/ # Test files
βββ start_project.sh # Project startup script
βββ README.md # This file
Create a .env file in the backend directory:
# Price service configuration
PRICE_CACHE_TTL=300 # Price cache TTL in seconds (default: 300)
PRICE_BATCH_SIZE=50 # Batch query size (default: 50)
PRICE_RATE_LIMIT_DELAY=1.2 # Request interval in seconds (default: 1.2)
PRICE_MAX_RETRIES=3 # Maximum retry attempts (default: 3)
PRICE_RETRY_BASE_DELAY=2 # Retry base delay in seconds (default: 2)
# CoinGecko API (optional, for higher rate limits)
COINGECKO_API_KEY=your_api_key_here
# Application settings
DEBUG=true # Enable debug mode
LOG_LEVEL=INFO # Logging level
HOST=0.0.0.0 # Server host
PORT=8010 # Server portPOST /api/assets- Add new assetGET /api/assets- Get asset listDELETE /api/assets/{asset_id}- Delete assetGET /api/assets/summary- Get asset summary
GET /api/price-service/stats- Get cache and request statisticsPOST /api/price-service/clear-cache- Clear all price cachePOST /api/price-service/clear-expired-cache- Clear expired cache
GET /api/tokens/search- Search tokensGET /api/tokens/{token_id}- Get token details
GET /api/blockchain/balance- Get wallet balanceGET /api/blockchain/chains- Get supported chains
GET /api/history/snapshots- Get historical snapshotsPOST /api/history/snapshot- Create manual snapshot
- Batch Queries: Combine multiple individual price queries into batch requests
- Smart Caching: Same tokens won't be queried repeatedly within cache validity period
- Preloading: Batch preload all prices when fetching asset lists
- Concurrent Processing: Balance queries and price queries execute concurrently
- Cache Hits: Response time reduced from seconds to milliseconds on cache hits
- Rate Limit Handling: Intelligent request spacing to avoid API limits
- Timestamp-based Cache: Each price data has timestamps with automatic expiration
- LRU Cache: Token mapping uses LRU cache for improved query efficiency
- Configurable TTL: Cache lifetime configurable via environment variables
If you encounter "Address already in use" errors:
# Check port usage
lsof -i :8010 # Backend port
lsof -i :8020 # Frontend port
# Kill processes using ports
kill -9 <process_id>
# Or use batch cleanup
pkill -f "uvicorn.*8010"
pkill -f "frontend_server.py"- Port occupied: Use port cleanup commands above
- Service startup failure: Check Python environment and dependencies
- API call failures: Verify network connection and API key configuration
- Price data not loading: Check CoinGecko API status and rate limits
# Run tests
cd tests
python -m pytest
# Run with coverage
python -m pytest --cov=appThe application provides built-in monitoring endpoints:
/health- Health check endpoint/api/price-service/stats- Price service statistics- Application logs are stored in the
logs/directory
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- CoinGecko for providing cryptocurrency price data
- FastAPI for the excellent web framework
- web3.py for Ethereum blockchain integration
- All contributors who have helped improve this project
If you have any questions or need help:
- π§ Email: dev@example.com
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
β If you find this project helpful, please consider giving it a star on GitHub!