Version 3.3.0 | Multi-Country, Multi-Broker Discord Trading Automation
A Discord self-bot that automatically detects BTO/STC trading signals in Discord channels and executes trades across multiple brokers in the USA, Canada, and India.
- Multi-Country Broker Support: Trade across USA, Canada, and India markets
- New Broker Integrations: Questrade (Canada), Upstox, Zerodha, Dhan (India)
- Unified Broker Config Page: Manage all brokers from Admin → Broker Config
- Country-Aware Settings: Currency, timezone, and market hours per country
- Fixed database synchronization bugs for reliable trade tracking
- Quantity sync from broker positions in real-time
- 60-second grace period prevents premature trade closures
- Order ID tracking for proper trade-to-order matching
- Broker name normalization for consistency
- Discord Self-Bots: Using self-bots violates Discord's Terms of Service and may result in account termination. Use at your own risk.
- Trading Risk: This bot executes real trades with real money. Always test with paper trading first.
- No Warranty: This software is provided as-is with no guarantees. You are responsible for all trades executed.
- ✅ Multi-Country Support: USA, Canada, and India brokers
- ✅ Multi-Broker Support: 9 brokers across 3 countries
- ✅ Options & Stocks: Full support for both asset types
- ✅ Paper Trading: Safe testing with Alpaca Paper, IBKR Paper, Webull Paper
- ✅ Risk Management: Automated stop-loss, profit targets, trailing stops
- ✅ Web Control Panel: Flask-based GUI for easy management
- ✅ Real-time Sync: Database stays synchronized with broker positions
- ✅ AI Signal Learning: Teach custom signal formats once, use forever
- ✅ Per-Channel Settings: Independent risk settings per Discord channel
- ✅ PNL Tracking: Comprehensive profit/loss analytics and leaderboard
BotifyTrades supports trading across multiple countries with region-specific brokers:
| Broker | Library | Options | Stocks | Paper Trading |
|---|---|---|---|---|
| Webull | webull |
Yes | Yes | Yes |
| Alpaca | alpaca-py |
Yes | Yes | Yes |
| Interactive Brokers | ib-insync |
Yes | Yes | Yes |
| Tastytrade | tastytrade |
Yes | Yes | Yes |
| Robinhood | robin-stocks |
Yes | Yes | No |
| Broker | Library | Options | Stocks | Token Expiry |
|---|---|---|---|---|
| Questrade | qtrade |
Yes | Yes | 30-min access / 3-day refresh |
| Broker | Library | Options | Stocks | Token Expiry |
|---|---|---|---|---|
| Upstox | upstox-python-sdk |
Yes | Yes | 1 day |
| Zerodha (Kite) | kiteconnect |
Yes | Yes | Daily 6 AM IST |
| Dhan | dhanhq |
Yes | Yes | 24 hours |
Access the unified broker configuration page at Admin → Broker Config in the web control panel. Features include:
- Country tabs for organized broker management
- Dynamic credential forms per broker
- Test connection buttons with status feedback
- Encrypted credential storage
BTO 2 HOOD 67C 05/23 @0.74
BTO 1 RKLB 50c 11/14 @4.50
STC 1 AAPL 190P 11/15 @3.10
Format: BTO/STC QTY SYMBOL STRIKE[C/P] MM/DD @PRICE
BTO 10 AAPL @189.50
STC 5 AMD @128.20
Format: BTO/STC QTY SYMBOL @PRICE
Best for: Non-technical users, easy distribution
- Download the pre-built EXE package
- Follow setup guide in
EXE_SETUP.md - No Python installation required
- See
build_instructions.mdto build your own EXE
Best for: Testing, development, 24/7 operation
- Use Replit Secrets for credentials (most secure)
- Keep browser tab open or use Reserved VM
- Follow setup instructions below
Best for: Development, testing, full control
- Requires Python 3.11+
- Works on Windows, Mac, and Linux
- Full source code access and customization
- See detailed setup instructions below
- Python 3.11 or higher (Download here)
- pip (Python package manager - included with Python)
- Git (optional, for cloning the repository)
- Stable internet connection
Option A: Clone with Git
git clone <your-repo-url>
cd discord-trading-botOption B: Download ZIP
- Download this Replit as a ZIP file
- Extract to a folder on your computer
- Open terminal/command prompt in that folder
Windows (Command Prompt or PowerShell):
pip install -r requirements.txtMac/Linux:
pip3 install -r requirements.txtManual Installation (if requirements.txt missing):
pip install discord.py-self==2.0.1 webull==0.6.1 openai==2.0.0 yfinance==0.2.0 ta==0.11.0 aiohttp==3.9.0 requests==2.28.0- Open
config.iniin a text editor - Update channel IDs, trading settings, and preferences
- Set
paper_trade = truefor testing (recommended)
[discord]
channel_ids = YOUR_CHANNEL_ID_1,YOUR_CHANNEL_ID_2
[webull]
paper_trade = true # Start with paper trading!You have two options for credential storage:
Windows (PowerShell):
$env:DISCORD_USER_TOKEN="your_discord_token_here"
$env:WEBULL_USERNAME="your_email@example.com"
$env:WEBULL_PASSWORD="your_password"
$env:WEBULL_TRADE_PIN="123456"
$env:FINNHUB_API_KEY="your_finnhub_key"
$env:ALPHA_VANTAGE_API_KEY="your_alphavantage_key"
$env:OPENAI_API_KEY="your_openai_key"Windows (Command Prompt):
set DISCORD_USER_TOKEN=your_discord_token_here
set WEBULL_USERNAME=your_email@example.com
set WEBULL_PASSWORD=your_password
set WEBULL_TRADE_PIN=123456
set FINNHUB_API_KEY=your_finnhub_key
set ALPHA_VANTAGE_API_KEY=your_alphavantage_key
set OPENAI_API_KEY=your_openai_keyMac/Linux:
export DISCORD_USER_TOKEN="your_discord_token_here"
export WEBULL_USERNAME="your_email@example.com"
export WEBULL_PASSWORD="your_password"
export WEBULL_TRADE_PIN="123456"
export FINNHUB_API_KEY="your_finnhub_key"
export ALPHA_VANTAGE_API_KEY="your_alphavantage_key"
export OPENAI_API_KEY="your_openai_key"Make Environment Variables Permanent:
Windows: Add to System Environment Variables via Control Panel
Mac/Linux: Add to ~/.bashrc or ~/.zshrc:
echo 'export DISCORD_USER_TOKEN="your_token"' >> ~/.bashrc
source ~/.bashrcSimply run the bot without setting environment variables:
python src/selfbot_webull.pyThe bot will prompt you to enter credentials interactively. They will be encrypted and saved locally.
Discord User Token:
- Open Discord in your browser
- Press F12 → Console tab
- Paste:
(webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken() - Copy the token
Finnhub API Key (Free - 60 calls/min):
- Sign up at https://finnhub.io/register
- Get your free API key from dashboard
Alpha Vantage API Key (Free - 25-500 calls/day):
- Get free key at https://www.alphavantage.co/support/#api-key
OpenAI API Key:
- Sign up at https://platform.openai.com/
- Create API key in dashboard
- Alternative: Use Replit AI integration (no OpenAI key needed)
python src/selfbot_webull.pyYou should see:
[Discord] ✓ Logged in as YourUsername#0
[Webull] ✓ Login successful
[Discord] ✓ Monitoring channels:
- #channel-name in Server Name
[Init] ✓ Worker started; processing signals.
- Ensure
paper_trade = truein config.ini - Post a test signal in your monitored Discord channel:
BTO AAPL 150C 12/20 @2.50 - Check console logs - you should see the signal detected
- Verify it's a paper trade (no real order placed)
- Bot stops when you close the terminal/window
- Bot stops when your computer sleeps or shuts down
- Internet disconnections will stop the bot
- You must keep your computer running 24/7
Best for: Reliable 24/7 automated trading
Providers:
- DigitalOcean ($6/month) - digitalocean.com
- Linode/Akamai ($5/month) - linode.com
- AWS Lightsail ($3.50/month) - aws.amazon.com/lightsail/
- Vultr ($2.50/month) - vultr.com
VPS Setup:
# 1. SSH into your VPS
ssh root@your-vps-ip
# 2. Install Python
sudo apt update
sudo apt install python3.11 python3-pip git -y
# 3. Clone your bot
git clone <your-repo>
cd discord-trading-bot
# 4. Install dependencies
pip3 install -r requirements.txt
# 5. Set environment variables
nano ~/.bashrc # Add export commands
# 6. Run bot in background with screen/tmux
screen -S trading-bot
python3 src/selfbot_webull.py
# Press Ctrl+A, then D to detach
# Bot keeps running even after you disconnect!- Disable sleep mode
- Configure auto-restart on crashes
- Use a dedicated computer (old laptop works great)
- Already set up in this environment
- Automatic restarts
- Built-in secrets management
- No server maintenance required
| Feature | Local Machine | Cloud VPS | Replit |
|---|---|---|---|
| Cost | Free | $3-6/month | Uses credits |
| 24/7 Uptime | ❌ (must keep PC on) | ✅ | ✅ |
| Setup Difficulty | Easy | Medium | Easiest |
| Auto-restart | ❌ | ✅ (with setup) | ✅ |
| Customization | ✅ Full | ✅ Full | |
| Security | ✅ Built-in | ||
| Best For | Testing/Dev | Serious traders | Quick start |
Edit config.ini:
[discord]
channel_ids = YOUR_CHANNEL_ID_1,YOUR_CHANNEL_ID_2
allowed_author_ids = OPTIONAL_AUTHOR_ID_FILTER
allowed_guild_ids = OPTIONAL_GUILD_ID_FILTER
[webull]
paper_trade = true # Set to false for live tradingClick the 🔒 Secrets icon in the left sidebar and add:
Required Secrets:
DISCORD_USER_TOKEN- Your Discord user tokenWEBULL_TRADE_PIN- Your 6-digit trading PIN
Choose ONE authentication method:
Method A: Username/Password (Will prompt for login)
WEBULL_USERNAME- Your Webull emailWEBULL_PASSWORD- Your Webull password
Method B: Saved Tokens (Faster, no login prompt)
WEBULL_ACCESS_TOKEN- Your Webull access tokenWEBULL_REFRESH_TOKEN- Your Webull refresh tokenWEBULL_DID- Your Webull device ID
How to get your Discord user token:
- Open Discord in your browser
- Press F12 to open Developer Tools
- Go to Console tab
- Paste:
(webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken() - Copy the token and add it to Replit Secrets as
DISCORD_USER_TOKEN
How to get Webull tokens (Method B):
- Open https://app.webull.com in your browser and log in
- Press F12 → Console tab
- Paste this code:
console.log(JSON.stringify({
accessToken: sessionStorage.accessToken || localStorage.accessToken || localStorage.ACCESS_TOKEN || '',
refreshToken: sessionStorage.refreshToken || localStorage.refreshToken || localStorage.REFRESH_TOKEN || '',
did: sessionStorage.did || localStorage.did || sessionStorage.deviceId || localStorage.deviceId || ''
}));- Copy the values and add them to Replit Secrets as
WEBULL_ACCESS_TOKEN,WEBULL_REFRESH_TOKEN, andWEBULL_DID
The bot will start automatically when you run the Repl. Check the console for:
- ✓ Discord login confirmation
- ✓ Webull login confirmation
- ✓ List of monitored channels
- ✓ Paper trading mode status
- Start with paper trading enabled (
paper_trade = true) - Send a test signal in a monitored channel
- Check console logs to verify signal detection
- Verify the paper trade is logged (no real order placed)
- Paper Trading Mode: Test without risking real money
- Author Filtering: Only accept signals from specific users
- Guild Filtering: Only monitor specific servers
- Channel Filtering: Only specific channels are monitored
- Comprehensive Logging: All actions are logged for review
- Verify channel IDs are correct in config.ini
- Check author/guild filters aren't blocking messages
- Review console logs for parsing errors
- Verify credentials are correct
- Check if 2FA is enabled (may need manual token bootstrap)
- Ensure trade PIN is exactly 6 digits
- Check if paper_trade is enabled
- Verify Webull account has sufficient funds
- Review console logs for specific errors
- ✅ Use environment variables for all sensitive data
- ✅ Keep config.ini in .gitignore
- ✅ Never share your Discord token or Webull credentials
- ✅ Start with paper trading enabled
- ✅ Monitor logs regularly for suspicious activity
This is unofficial software. For issues:
- Check console logs for error messages
- Verify all credentials are correct
- Test with paper trading first
- Review signal format carefully
Use at your own risk. No warranty provided.