Telegram bot to display crypto price
Prerequisites: Ensure you have Python 3.7 or higher installed on your system. Create a Telegram Bot: Start by creating a bot on Telegram using the BotFather. Follow these steps:
-
Open Telegram and search for @BotFather. Type /newbot and follow the instructions. Save the API token provided by BotFather.
-
Install the necessary Python packages: pip install python-telegram-bot requests
-
We’ll use the CoinGecko API to fetch real-time crypto data. Specifically, we’ll make a GET request to the /coins/markets endpoint to get data like current price, market cap, volume, and price change percentage.
-
Run the Python script. Your bot should now respond to /start and /price <crypto_symbol> commands.
-
Remember to replace 'YOUR_BOT_TOKEN' with your actual Telegram bot token and the Coingecko api with your API