Automated email alerts for Vietnamese ETF buying opportunities with multi-level signal detection.
- Monitors 4 ETFs: FUESSV30, E1VFVN30, FUEVFVND, FUESSVFL
- Multi-level buy signals:
- 🟡 WEAK - Early warning, monitor closely
- 🟠 MODERATE - Good buying opportunity
- 🔴 STRONG - Significant dip, strong buy signal
- Sends beautiful HTML email alerts with color-coded metrics
- Fully configurable thresholds via environment variables
- Runs automatically via GitHub Actions at 4:00 PM ICT (weekdays)
The system detects three levels of buy signals based on RSI and Moving Average indicators:
| Level | RSI Threshold | MA Dip Threshold | Meaning |
|---|---|---|---|
| 🟡 WEAK | < 40 | 3%+ below MA | Early opportunity, watch closely |
| 🟠 MODERATE | < 35 | 5%+ below MA | Good entry point |
| 🔴 STRONG | < 30 | 7%+ below MA | Excellent buying opportunity |
Email is sent ONLY when at least one ETF triggers a signal. If all ETFs are above thresholds, no email is sent.
pip install -r requirements.txtCreate a .env file:
cp .env.example .envEdit .env with your credentials:
SENDER_EMAIL=your-email@gmail.com
SENDER_PASSWORD=your-app-password
RECIPIENT_EMAIL=holla.at.lam@gmail.com
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
# Configurable thresholds
RSI_WEAK=40
RSI_MODERATE=35
RSI_STRONG=30
MA_DIP_WEAK=3
MA_DIP_MODERATE=5
MA_DIP_STRONG=7Gmail Setup:
- Go to Google Account → Security
- Enable 2-Step Verification
- Generate App Password: Security → 2-Step Verification → App passwords
- Use the 16-character app password (not your regular password)
Test the script:
python etf_alert.pyDebug mode (see all metrics):
python debug_etf.py-
Push this repository to GitHub
-
Add secrets to your repository:
- Go to Settings → Secrets and variables → Actions
- Click "New repository secret" and add each of these:
| Secret Name | Value | Example |
|---|---|---|
SENDER_EMAIL |
Your Gmail address | your-email@gmail.com |
SENDER_PASSWORD |
Gmail app password | abcd efgh ijkl mnop |
RECIPIENT_EMAIL |
Email to receive alerts | holla.at.lam@gmail.com |
SMTP_SERVER |
SMTP server | smtp.gmail.com |
SMTP_PORT |
SMTP port | 587 |
RSI_WEAK |
Weak RSI threshold | 40 |
RSI_MODERATE |
Moderate RSI threshold | 35 |
RSI_STRONG |
Strong RSI threshold | 30 |
MA_DIP_WEAK |
Weak MA dip % | 3 |
MA_DIP_MODERATE |
Moderate MA dip % | 5 |
MA_DIP_STRONG |
Strong MA dip % | 7 |
- The workflow will run automatically:
- Schedule: Monday-Friday at 4:00 PM ICT (9:00 AM UTC)
- Manual: Go to Actions → ETF Alert System → Run workflow
- Data Collection: Fetches 50 days of historical data for each ETF
- Indicator Calculation:
- RSI (14-day) - Measures momentum
- 20-day Moving Average - Identifies trend
- Signal Detection: Compares current values against thresholds
- Alert Priority: Uses the strongest signal level detected
- Email Notification: Sends color-coded HTML email if any signal is detected
Edit your .env file to tune the thresholds:
More aggressive (catch more opportunities):
RSI_WEAK=45
RSI_MODERATE=40
RSI_STRONG=35
MA_DIP_WEAK=2
MA_DIP_MODERATE=4
MA_DIP_STRONG=6More conservative (fewer but stronger signals):
RSI_WEAK=35
RSI_MODERATE=30
RSI_STRONG=25
MA_DIP_WEAK=5
MA_DIP_MODERATE=7
MA_DIP_STRONG=10Edit etf_alert.py line 264:
etf_symbols = ['fuessv30', 'e1vfvn30', 'fuevfvnd', 'fuessvfl', 'your-new-etf']etf_alert/
├── .github/
│ └── workflows/
│ └── etf_alert.yml # GitHub Actions workflow
├── etf_alert.py # Main alert script
├── debug_etf.py # Debug tool to see all metrics
├── requirements.txt # Python dependencies
├── .env.example # Configuration template
├── .gitignore # Git ignore rules
└── README.md # This file
python etf_alert.py- Checks all ETFs
- Sends email if signals detected
- Use this for production
python debug_etf.py- Shows detailed metrics for all ETFs
- Displays configured thresholds
- Shows which conditions are met
- Use this to test thresholds
No email received:
- Check GitHub Actions logs
- Verify email credentials in Secrets
- Ensure Gmail app password is correct
- Check spam folder
- Run
python debug_etf.pyto see if signals are triggering
Script fails:
- Verify
vnstocklibrary supports the ETF symbols - Check internet connection for API access
- Review error logs in Actions tab
- Ensure all environment variables are set
Alerts too frequent/infrequent:
- Run
python debug_etf.pyto see current metrics - Adjust thresholds in
.envfile - Update GitHub Secrets if running on Actions
The alert emails include:
- Beautiful gradient header
- Color-coded signal strength badges
- Current price, 20-day MA, RSI metrics
- Visual indicators showing which thresholds triggered
- Legend explaining signal levels
- All ETFs with signals in one email
Feel free to customize this for your needs. Key areas to modify:
- Thresholds in
.env - ETF list in
etf_alert.py - Email styling in
format_email_body()function - Schedule in
.github/workflows/etf_alert.yml