Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CCASS Data Scraper Bot

A Python bot that scrapes daily CCASS shareholding data from Webb-site and sends reports via Telegram.

Features

  • 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

Setup

Option 1: Docker (Recommended)

  1. Create a .env file with your Telegram credentials:
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id
  1. Build and run with Docker Compose:
docker-compose up -d

The bot will send a startup notification to your Telegram chat when successfully launched.

Option 2: Direct Python Installation

  1. Clone the repository
  2. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables:
export TELEGRAM_BOT_TOKEN="your_telegram_bot_token"
export TELEGRAM_CHAT_ID="your_telegram_chat_id"
  1. Run the bot:
python ccass_bot.py

Getting Telegram Credentials

To get these values:

  1. Create a Telegram bot using @BotFather to get TELEGRAM_BOT_TOKEN
  2. Send a message to your bot and visit https://api.telegram.org/bot<YourBOTToken>/getUpdates to get TELEGRAM_CHAT_ID

Schedule

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

Report Format

The daily report includes:

  • Date of the report
  • For each participant:
    • Top 5 shareholding increases
    • Top 5 shareholding decreases

Docker Management

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

Error Handling

  • 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

Notes

  • 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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages