Skip to content

A python-based bot that fetches real-time cryptocurrency prices from Coingecko and presents them in an easy-to-understand format on Telegram.

License

Notifications You must be signed in to change notification settings

halon176/h-crypto-price-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HCryptoPrice

build license: MIT

HCryptoPrice is a Python-based bot that fetches real-time cryptocurrency prices from Coingecko and presents them in an easy-to-understand format on Telegram. It also offers historical price data, market cap rankings.

If you want to use more advanced bot features as call limits, you can use the API interaction, which is available in the hcpb-api repository. ⚠️ The API is still under development. ⚠️

Here's a working version of the bot: @h_crypto_price_bot

Installation

Manual

  1. First, make sure you have Python 3.11 installed on your machine. You can check your Python version by opening a terminal and running the following command:
python --version
  1. Next, clone the h-crypto-price-bot repository to your local machine. You can do this by running the following command in your terminal:
git clone https://github.com/halon176/h-crypto-price-bot.git
  1. Change into the directory where the bot's code is located, the install the dependencies using Poetry:
cd h-crypto-price-bot
poetry install
  1. Create a new Telegram bot by following the instructions in the Telegram Bot API documentation: https://core.telegram.org/bots#6-botfather

  2. After creating your bot, copy the token provided by BotFather. Then, set up an environment variable named TOKEN with the bot token using the following command, replacing <telegram_bot_token> with your bot token:

export TELEGRAM_TOKEN=<telegram_bot_token>

To use the gas price feature, you must include an Etherscan API key. Other keys are optional.

export ETHSCAN_API_KEY=<etherscan_api_key>
export CMC_API_KEY=<coinmarketcap_api_key>
export API_URL=<api_url>
  1. Run the bot by running the following command:
python src/main.py

Your bot should now be up and running! You can add it to a Telegram group or start a chat with it to test it out.

Docker

  1. Clone the h-crypto-price-bot repository to your local machine. You can do this by running the following command in your terminal:
git clone https://github.com/halon176/h-crypto-price-bot.git
  1. Launch the 'docker build' command to build your Docker image.
docker build -t h-crypto-price h-crypto-price-bot/.
  1. Now you can start the container using the command, replacing <telegram_bot_token> with your bot token:
docker run -d -e TELEGRAM_TOKEN=<telegram_bot_token> --name h-crypto-price h-crypto-price

To use the gas price feature, you must include an Etherscan API key. ETHSCAN_API_KEY=<etherscan_api_key>

docker run -d -e TELEGRAM_TOKEN=<telegram_bot_token> -e ETHSCAN_API_KEY=<etherscan_api_key> --name h-crypto-price h-crypto-price

The bot is now up and running within the Docker container!

Usage

The bot can receive requests using the command /p followed by the cryptocurrency symbol, for example:

/p btc
/p eth
/p cro

To display the list of all available commands, type /help

Roadmap

  • Build more interactions with API, such as store settings and call limits.

Contributing

Contributions are welcome! If you have any suggestions or bug reports, please open an issue on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A python-based bot that fetches real-time cryptocurrency prices from Coingecko and presents them in an easy-to-understand format on Telegram.

Topics

Resources

License

Stars

Watchers

Forks

Packages