A Telegram bot that provides real-time cryptocurrency prices, alerts, and portfolio tracking using the Telegraf framework and CoinGecko API.
✅ Fetch live crypto prices from CoinGecko.
✅ Track your crypto portfolio.
✅ Fetch real-time CoinGecko trading data.
✅ Supports Telegram commands like /price
, /news
, /buy
, /sell
, /dex
, /setting
and /help
.
✅ GPT Investment advice based on recent news.
✅ Deployable on Railway, AWS, or Heroku.
- Node.js (v14+)
- Telegram Bot API Token (from BotFather)
- CoinGecko API (No API key required)
git clone https://github.com/yourusername/crypto-telegram-bot.git
cd crypto-telegram-bot
npm install
Create a .env
file and add your Telegram Bot API Key:
TELEGRAM_BOT_TOKEN=your_telegram_bot_api_key
node bot.js
Your bot is now running! Open Telegram, find your bot, and try:
/price bitcoin
graph TD
User["Telegram User"] --> |"message / commands"| Bot["Node.js Telegram Bot"]
Bot --> |"Query GPT Thread"| Redis["Redis (GPT Thread Storage)"]
Bot --> |"Retrieve Encrypted API"| MongoDB["MongoDB (User Binance API)"]
MongoDB --> |"Decrypt API Key"| Bot
Bot --> |"Execute Binance Trade"| Binance["Binance API"]
Bot --> |"Check price"| CoinGecko["CoinGecko API"]
Bot --> |"Fetch Crypto news"| Cryptopanic["Cryptopanic API"]
Redis --> |"Retrieve GPT Thread"| Bot
Redis --> |"Store GPT Conversation"| Bot
Command | Description |
---|---|
/start |
Start the bot |
/help |
Show available commands |
/price <coin> |
Get the current price of a cryptocurrency (e.g., /price bitcoin ) |
/dex |
View your dex wallet balance |
/buy <coin> <quantity> |
Buy crypto with Binance API (e.g., /buy bitcoin 0.5 ) |
/sell <coin> <quantity> |
Sell crypto with Binance API (e.g., /sell bitcoin 0.5 ) |
You can deploy the bot on Railway, Heroku, or AWS.
- Push your bot to GitHub.
- Go to Railway.app → New Project → Deploy from GitHub.
- Set the environment variables:
TELEGRAM_BOT_TOKEN
BINANCE_APIKEY
BINANCE_APISECRET
METAMASK_API
- Click Deploy 🚀.
✅ Add support for NFT tracking and DeFi analytics.
✅ Implement machine learning-based trading signals.
Feel free to fork this project, submit a PR, or suggest new features!
💎 Contact: [email protected]
- Node.js - Backend framework
- Telegraf.js - Telegram bot library
- CoinGecko API - Fetch live crypto prices
- Redis - Caching for faster responses
- MongoDB - Storing user portfolios
This project is licensed under the MIT License - see the LICENSE file for details.
🚀 Start your Crypto Telegram Bot today! Let me know if you need any improvements. 😃