A Python bot that scrapes daily CCASS shareholding data from Webb-site and sends reports via Telegram.
- Daily scraping of CCASS data for specified participants (1323 and 1456)
- Automated report generation with top increases and decreases
- Telegram bot integration for daily reports
- Timezone-aware scheduling (HK time 19:00)
- Startup notification
- Docker support for easy deployment
- Error handling and logging
- Create a
.envfile with your Telegram credentials:
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id- Build and run with Docker Compose:
docker-compose up -dThe bot will send a startup notification to your Telegram chat when successfully launched.
- Clone the repository
- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
export TELEGRAM_BOT_TOKEN="your_telegram_bot_token"
export TELEGRAM_CHAT_ID="your_telegram_chat_id"- Run the bot:
python ccass_bot.pyTo get these values:
- Create a Telegram bot using @BotFather to get
TELEGRAM_BOT_TOKEN - Send a message to your bot and visit
https://api.telegram.org/bot<YourBOTToken>/getUpdatesto getTELEGRAM_CHAT_ID
The bot will:
- Send a startup notification when launched
- Run daily at 19:00 HK time
- Fetch CCASS data for participants 1323 and 1456
- Send a formatted report via Telegram
The daily report includes:
- Date of the report
- For each participant:
- Top 5 shareholding increases
- Top 5 shareholding decreases
Common commands:
# View logs
docker-compose logs -f
# Restart the bot
docker-compose restart
# Stop the bot
docker-compose down
# Update and rebuild
docker-compose build --no-cache
docker-compose up -d- All errors are logged to stdout with timestamps
- The bot will continue running even if data fetching fails for one participant
- Network errors are handled gracefully with appropriate logging
- Docker container will automatically restart on failure
- The script uses Hong Kong timezone (UTC+8) for all operations
- Data is fetched from webb-site.com
- The bot requires stable internet connection
- Rate limiting and respectful scraping practices are implemented