A Twitter bot that posts daily updates showing Bitcoin's current price and how far it is from its all-time high.
Bitcoin: $104,250
ATH: $108,135 (Dec 17, 2024)
Discount: 3.6% below ATH
Upside to ATH: 3.7%
#Bitcoin #BTC
- Go to developer.twitter.com
- Create a new project and app
- Set app permissions to Read and Write
- Generate these credentials:
- API Key
- API Secret
- Access Token
- Access Token Secret
git clone https://github.com/YOUR_USERNAME/btc-ath-bot.gitGo to your repo → Settings → Secrets and variables → Actions → New repository secret
Add these 4 secrets:
TWITTER_API_KEYTWITTER_API_SECRETTWITTER_ACCESS_TOKENTWITTER_ACCESS_SECRET
The workflow runs daily at 9:00 AM UTC. You can also trigger it manually from the Actions tab.
# Install dependencies
pip install -r requirements.txt
# Dry run (no Twitter credentials = just prints the tweet)
python bot.py
# With credentials
export TWITTER_API_KEY="your_key"
export TWITTER_API_SECRET="your_secret"
export TWITTER_ACCESS_TOKEN="your_token"
export TWITTER_ACCESS_SECRET="your_token_secret"
python bot.py- Post time: Edit
.github/workflows/post-daily.ymlcron schedule - Tweet format: Edit
format_tweet()inbot.py - Add more data: CoinGecko API returns lots of data (24h change, market cap, etc.)
- Price data: CoinGecko API (free, no API key required)
- Twitter: Twitter API v2 via Tweepy