area bc1 is a Telegram Bot to view Bitcoin-related statistics, make custom charts, explore blockchain and get regular notifications defined by user. Inspired by ideas of self-sovereignty and designed with love to Matt Stone, Trey Parker and Grey Visitors.
Bot uses python-telegram-bot
as a wrapper for Telegram API. All user commands in bot.py
have same name as files in cmds/{module}.py
. Commands are available in private chats and groups, different command behavior executed using update.effective_chat.type
. User input for notifications stored in context.chat_data
and passed to schedule
. Nested conversations in private chats use states. Bot uses concurrent.futures
to run continuous database updates in separate thread and asyncio
for notifications.
Database architecture described in config.py
. Database initialized and updated regularly with update_databases()
in tools.py
. Data fetched from API providers (listed below) with requests
. Chart data transferred to DataFrame with pandas
and modified according to template specified in config.py
. Files saved to db/{command}/{command}
as .json
or .csv
. Regular database updates made by importing cmds/{module}.py
with importlib
to schedule
.
Images and text made by draw_{command}(day)
and write_{command}(day)
in cmds/{module}.py
. Default day and image parameters defined in config.py
. Plot data transferred to DataFrame with pandas
and re-arranged with numpy
. Lines and axes made with matplotlib
. Image titles added with pillows
. Image backgrounds are chosen from src/image/backrounds/{module}_[down|up].png
with define_key_metric_movement()
from tools.py
. Text parsed from database files, direct API response or scraped and parsed with beautifulsoup4
. Text values formatted with various functions from tools.py
. Files saved to db/{command}/{command}_days_{day}
as .jpg
or .md
. User generated images and text removed with clean_databases()
in tools.py
pip3 install -r requirements.txt
python3 bot.py
- Save user input for notifications separately for automatic rescheduling notifications after bot restart.
- Disable unsupported commands if
currency_crypto
andcurrency_crypto_ticker
inconfig.py
changed to different cryptocurrency. - Make
./install.sh
with instructions forsrc/image/backgrounds
andsrc/text
files. - Make proper
Dockerfile
.
This bot is powered by:
- CoinGecko.com API - Market, CEX
- Mempool.Space API - Fees, Lightning
- Blockchain.com API - Blockchain, Network, Pools
- Coinqueror.io Data Scraping - News
- Dune.com API - ETFs, Seized
This bot uses free plans provided by API Sources. To comply with rate limits regular updates are throttled by periods specified in config.py
.