A sophisticated Discord bot that calculates daily Dollar Cost Averaging (DCA) entry signals for ETFs and stocks based on technical analysis metrics. The bot includes a web interface for configuration management and backtesting capabilities.
- Automated Daily Scoring: Calculates entry signals for multiple tickers based on your custom formulas
- Discord Notifications: Sends daily score updates to Discord via webhooks with formatted messages and alerts
- Web Administration Interface: Full-featured web UI for managing everything - tickers, weights, formulas, and configuration (no need to edit config files!)
- Backtesting Engine: Historical performance analysis with visual results and detailed metrics
- Fully Customizable Scoring:
- Define your own Python-based scoring formulas
- Adjust component weights dynamically
- Access to technical indicators (RSI, MA, momentum, volatility, etc.)
- Real-time formula validation and preview
- Minimal Configuration: Only admin token required in
config.yaml- everything else (including webhook) via web UI - Docker Support: Fully containerized deployment with Docker Compose
- Historical Data Tracking: Persistent storage of daily scores in CSV format and SQLite database
- Docker and Docker Compose
- Discord webhook URL (for notifications)
git clone https://github.com/lukyyy9/DEDBot.git
cd DEDBotCreate a minimal config.yaml with only the admin token:
# Admin token for web interface access
admin:
admin_tokens:
- "your-secure-admin-token-here"mkdir -p dataUsing the provided script:
chmod +x start-v2.sh
./start-v2.shOr manually with Docker Compose:
docker-compose up -dThe project consists of two main services:
- Runs scheduled daily scoring calculations
- Fetches market data from Yahoo Finance
- Calculates technical indicators using your custom formulas
- Sends notifications to Discord
- Logs results to CSV and SQLite database
- Admin authentication system
- Database-driven configuration management (no file editing required)
- Real-time configuration updates (tickers, weights, formulas, caps)
- Live scoring preview
- Backtesting interface with visual results
- Runs on port 5001
- config.yaml: Minimal bootstrap settings (admin tokens only - webhook optional)
- SQLite Database (
/data/bot_config.db): All runtime configuration- Discord webhook URL
- Tickers list
- Custom formulas
- Component weights
- System settings (caps, periods, etc.)
The bot calculates a composite score (0-100) based on fully customizable formulas and weights. All scoring components are user-managed through the web interface.
The scoring system is entirely flexible - you define:
- Custom Formulas: Create scoring formulas using Python expressions
- Component Weights: Adjust the importance of each component
- Available Variables:
drawdown- Distance from all-time highrsi- Relative Strength Indexclose,ma50,ma200- Price and moving averagesmomentum- Price momentumvol20- 20-day volatilitynp- NumPy functions (clip, exp, etc.)
# RSI-based scoring (oversold = opportunity)
np.clip((70.0 - rsi) / 40.0, 0.0, 1.0)
# Drawdown scoring
min(drawdown / cap, 1.0)
# Distance from MA50
np.clip((ma50 - close) / ma50 / 0.15, 0.0, 1.0)- β 55-100: Strong entry signal (triggers @everyone alert)
β οΈ 45-54: Neutral zone- β 0-44: Weak entry signal
Access the web interface at http://localhost:5001
- Dashboard: Overview of current configuration and recent scores
- Tickers Management: Add/remove ETFs and stocks to monitor (no config.yaml editing needed)
- Weights Configuration: Adjust scoring component weights in real-time
- Weight Profiles: Save and manage multiple weight configurations
- Quickly switch between different testing profiles
- Create, edit, and delete profiles with descriptions
- One-click profile activation to load saved weights
- Formulas Editor: Create and manage custom Python scoring formulas with syntax validation
- Configuration Editor: Modify caps, periods, and other settings through the UI
- Backtest: Historical performance analysis with visual charts and metrics
All configuration changes are stored in a SQLite database (/data/bot_config.db) and take effect immediately.
Use one of the admin tokens defined in config.yaml to access the interface.
TZ: Timezone (default: UTC)DEV: Development mode - "true" runs every minute, "false" runs dailySECRET_KEY: Flask secret key for web interface sessions
./config.yaml:/app/config.yaml:ro- Configuration file (read-only)./data:/data- Persistent data storage
5001: Web interface port
.
βββ bot_daily_score_v2.py # Main bot script with scheduler
βββ web_app.py # Flask web interface
βββ backtest_v2.py # Backtesting script
βββ config.yaml # Configuration file
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker image definition
βββ docker-compose.yml # Multi-service orchestration
βββ start-v2.sh # Quick start script
βββ core/ # Core modules
β βββ __init__.py
β βββ config.py # Configuration manager
β βββ scoring.py # Scoring engine
β βββ backtest.py # Backtest engine
βββ templates/ # HTML templates for web interface
βββ static/ # Static assets (CSS, JS)
βββ data/ # Persistent data directory
βββ scores_history.csv
βββ backtest_results.csv
βββ bot_daily_score.log
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- Built with yfinance for market data
- Uses Flask for the web interface
- Scheduled with APScheduler
For issues and questions, please open an issue on the GitHub repository.
Note: This bot is for educational and informational purposes only. Always do your own research before making investment decisions.