A Discord bot that tracks Bitcoin prices using the CoinMarketCap API and sends regular updates and price alerts to designated Discord channels.
- Hourly Bitcoin price updates
- Customizable price alerts for when Bitcoin crosses specified thresholds
- Price history tracking and storage
- Detailed logging system
- Configurable through JSON file
- Create a
config.json
file with the following structure:
{
"cmc_api_key": "your_coinmarketcap_api_key",
"price_alerts": {
"above": 50000,
"below": 40000
}
}
- Install required dependencies:
pip install requests discord.py
- Add the bot to your Discord server and create a channel named
bitcoin-alerts
- Run the bot:
python bitcoin_tracker.py
- The bot will automatically:
- Post hourly updates in the
#bitcoin-alerts
channel - Send alerts when Bitcoin price crosses configured thresholds
- Store price history in
price_history.json
- Log activities in
bitcoin_tracker.log
- Post hourly updates in the
- Check
bitcoin_tracker.log
for detailed operation logs - View price history in
price_history.json
- Monitor updates in the Discord
#bitcoin-alerts
channel
Make sure to keep your CoinMarketCap API key and Discord bot token secure and never share them publicly.