Telegram bot for crypto portfolio tracking and alerts. Monitors prices, sends notifications, and provides market analysis.
A production-ready Telegram-based crypto trading platform with subscription management, perpetual DEX trading, airdrop tracking, and comprehensive risk management.
- Telegram Integration: Bot commands and Mini App interface
- Telegram Mini App: Full web interface for trading
- WebSocket: Real-time trade/payment notifications
- JWT Authentication: Secure API access
- Wallet Connect: MetaMask integration
- Crypto Subscriptions: Invoice-based payments with on-chain verification
- Perp DEX Trading: Adapter-based architecture supporting multiple DEXs
- Risk Management: Position limits, slippage controls, kill switch
- Airdrop Helper: Eligibility tracking and progress monitoring
- Activity Dashboard: Full audit trail of all actions
app/
├── bot/ # Telegram bot handlers + Mini App
├── api/ # FastAPI endpoints + middleware + health + WebSocket
├── auth/ # JWT authentication
├── core/ # Enums, exceptions, security
├── services/ # Business logic + Wallet Connect
├── adapters/ # DEX integrations
├── trading/ # Trading orchestrator + price feeds
├── airdrop/ # Airdrop engine
├── payments/ # Invoice & verification
├── dashboard/ # Event logging
├── models/ # SQLAlchemy models
├── config/ # Configuration
├── database/ # SQLAlchemy async manager
├── cache/ # Redis cache manager
├── tasks/ # Celery background tasks
└── celery_config/ # Celery configuration
pip install -r requirements.txtCreate .env file:
# Telegram
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_MINI_APP_URL=https://your-app.com
# Database
DATABASE__PATH=postgresql://user:pass@localhost/platform
REDIS_URL=redis://localhost:6379/0
# RPC URLs
RPC_URL_ETH=https://your-eth-rpc
RPC_URL_ARBITRUM=https://your-arbitrum-rpc
RPC_URL_OPTIMISM=https://your-optimism-rpc
# Celery
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/1
# Monitoring
SENTRY_DSN=https://[email protected]/xxx# tables are also auto-created at startup via create_all, so this step is
# optional for the sqlite dev flow; for postgres start here:
alembic revision --autogenerate -m "initial"
alembic upgrade head# API Server
uvicorn app.api.main:app --host 0.0.0.0 --port 8000 --reload
# Celery Worker
celery -A app.celery_config worker --loglevel=info
# Celery Beat (scheduler)
celery -A app.celery_config beat --loglevel=infopytest tests/ -v --cov=appWS /ws- Real-time updates (auth, subscribe, trade updates)
GET /health- Basic health checkGET /health/live- Liveness probeGET /health/ready- Readiness probeGET /health/metrics- Prometheus metrics
POST /api/subscription/createGET /api/subscription/status/{user_id}POST /api/subscription/activateGET /api/subscription/check-access/{user_id}
POST /api/payment/invoicePOST /api/payment/verifyPOST /api/payment/confirm/{payment_id}GET /api/payment/status/{user_id}
POST /api/trading/quotePOST /api/trading/executeGET /api/trading/history/{user_id}
POST /api/airdrop/check-eligibilityGET /api/airdrop/campaigns/{user_id}GET /api/airdrop/tasks/{campaign_id}
POST /api/dashboard/eventGET /api/dashboard/events/{user_id}GET /api/dashboard/summary/{user_id}
| Task | Schedule | Description |
|---|---|---|
check_expired_payments |
Every 5 min | Expire pending payments |
update_airdrop_progress |
Every 6 hours | Update airdrop progress |
check_daily_loss_limits |
Hourly | Check risk limits |
cleanup_old_events |
Daily 2 AM | Clean old dashboard events |
Полный рабочий файл — docker-compose.yml в корне репозитория: api, celery-worker, celery-beat, nginx, postgres:15-alpine, redis. Переменные окружения задаются через .env (DATABASE__PATH, REDIS_URL, TELEGRAM_BOT_TOKEN, RPC_URL_*, SENTRY_DSN; значения по умолчанию — внутри compose).
- Rate limiting (slowapi)
- Structured logging (structlog)
- Error tracking (Sentry)
- Health checks
- Metrics endpoint
- SSL/TLS termination
- API authentication
- Rate limiting per-user
- All user actions are explicitly user-initiated via commands
- No automated trading or bot-like behavior
- Payments verified on-chain with required confirmations
- All actions logged with full audit trail
- PostgreSQL for production, SQLite for development
- Demo DEX adapters (not connected to real DEXs)
- No real wallet integration - uses mock addresses
# Lint
ruff check app/
# Format
black app/
# Type check
mypy app/pre-commit installАвтор ssrjkk — QA Engineer
Telegram: @ssrjkk Email: [email protected] GitHub: https://github.com/ssrjkk
SSRJKK — GitHub · Telegram · Projects hub · Bot catalogue