This repository contains a Telegram bot designed to manage and track cryptocurrency balances for users. The bot fetches real-time cryptocurrency prices and allows users to update and view their wallet balances through simple commands.
- Fetch live cryptocurrency prices using Binance API (via
ccxt). - Manage user balances for cryptocurrencies: BTC, ETH, SOL, and TON.
- View total wallet balance in USD.
- Store user data securely in an SQLite database.
- Interactive Telegram bot commands for ease of use.
- Python 3.9+
- Telegram bot token (can be obtained via BotFather).
- Dependencies: Install from
requirements.txt.
-
Clone the repository:
git clone https://github.com/py-dima/Crypto-Balance-Bot.git cd crypto-telegram-bot -
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables: Create a
.envfile in the root directory:BOT_TOKEN=your_telegram_bot_token
-
Set up the database: Ensure the
base.dbfile is in the root directory with the appropriate schema:- Table:
main - Columns:
id(user ID),username,btc,eth,sol,ton.
- Table:
-
Run the bot:
python main.py
- Start the bot with
/startto initialize your profile. - Update your wallet balance:
/btc <amount>: Update BTC balance./eth <amount>: Update ETH balance./sol <amount>: Update SOL balance./ton <amount>: Update TON balance.
- View your wallet balance with
/balance.
.env: Environment variables.1.py: Fetches live cryptocurrency prices for specified symbols.docs.py: Provides a reusable function to fetch prices for a single symbol.main.py: Core bot logic, including database and command handling.base.db: SQLite database for storing user balances.
Feel free to contribute by forking this repository, making changes, and submitting a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Цей репозиторій містить Телеграм-бота для управління та відстеження балансу криптовалют користувачів. Бот отримує актуальні ціни на криптовалюти та дозволяє користувачам оновлювати і переглядати баланси своїх гаманців через прості команди.
- Отримання актуальних цін криптовалют через Binance API (за допомогою
ccxt). - Управління балансами користувачів для криптовалют: BTC, ETH, SOL, TON.
- Перегляд загального балансу гаманця у USD.
- Безпечне зберігання даних користувачів у базі SQLite.
- Інтерактивні команди Телеграм-бота для зручного використання.
- Python 3.9+
- Токен Телеграм-бота (можна отримати через BotFather).
- Залежності: встановіть із
requirements.txt.
-
Клонуйте репозиторій:
git clone https://github.com/py-dima/Crypto-Balance-Bot.git cd crypto-telegram-bot -
Встановіть залежності:
pip install -r requirements.txt
-
Налаштуйте змінні середовища: Створіть файл
.envу кореневій директорії:BOT_TOKEN=your_telegram_bot_token
-
Налаштуйте базу даних: Переконайтесь, що файл
base.dbзнаходиться у кореневій директорії та має відповідну структуру:- Таблиця:
main - Колонки:
id(ID користувача),username,btc,eth,sol,ton.
- Таблиця:
-
Запустіть бота:
python main.py
- Запустіть бота командою
/start, щоб ініціалізувати ваш профіль. - Оновлюйте баланс гаманця:
/btc <сума>: Оновлення балансу BTC./eth <сума>: Оновлення балансу ETH./sol <сума>: Оновлення балансу SOL./ton <сума>: Оновлення балансу TON.
- Перегляньте баланс гаманця командою
/balance.
.env: Змінні середовища.1.py: Отримання актуальних цін криптовалют для заданих символів.docs.py: Функція для отримання ціни одного символу.main.py: Основна логіка бота, включаючи базу даних та обробку команд.base.db: База даних SQLite для збереження балансів користувачів.
Ви можете зробити свій внесок, форкнувши цей репозиторій, внісши зміни та створивши pull request.
Цей проект ліцензовано за ліцензією MIT. Деталі дивіться у файлі LICENSE.