- Implemented /status command handler in telegram_command_bot.py - Shows real-time P&L, entry/current prices, TP/SL levels, position info - Added TRADING_BOT_URL and API_SECRET_KEY environment variables - Updated docker-compose.telegram-bot.yml with new env vars - Bot connects to trading-bot-v4:3000 API via internal Docker network - Added comprehensive documentation and testing guides - Command displays formatted position info with emojis (profit/loss indicators) - Shows 'No open positions' message when no trades active
2.7 KiB
2.7 KiB
Telegram Trading Bot - Quick Reference
🚀 Quick Setup (3 steps)
1. Import n8n workflow
- Open: http://10.0.0.48:8098
- Import:
telegram-manual-trade-FINAL.json - Connect last node to "Check Risk" in Money Machine
- Activate workflow
2. Get Telegram Bot Token
Run on your phone:
Open Telegram → @BotFather → /newbot → follow instructions
You'll get a token like: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz
3. Run setup
./complete_telegram_setup.sh
Paste your bot token when asked.
📱 Using it on your phone
Check Position Status
Send /status to see your current open position with:
- Real-time P&L (both $ amount and % of account)
- Entry price and current price
- TP1, TP2, and SL levels with status indicators
- Position size and leverage
- Trade age in minutes
Example output:
🟢 SOL-PERP 📈 LONG
💰 P&L: $3.50 (+0.70% account)
📊 Price Change: +0.07%
Entry: $142.5000
Current: $142.6000
Targets:
TP1: $143.4975 ⏳
TP2: $144.6375
SL: $140.3625
Position: $500.00 @ 10x
Age: 5 min
Execute Trades
Just send messages to your Telegram chat:
buy sol
sell btc
buy eth
sell sol
Or use commands:
/buySOL
/sellBTC
/buyETH
/status
The bot will:
- ✅ Parse your message
- ✅ Forward to n8n webhook
- ✅ n8n sends to your trading bot
- ✅ Trade executes with risk checks
- ✅ You get confirmation in Telegram
🔧 Management
View logs:
docker logs -f telegram-trade-bot
Restart bot:
docker restart telegram-trade-bot
Stop bot:
docker-compose -f docker-compose.telegram-bot.yml down
Start bot:
docker-compose -f docker-compose.telegram-bot.yml --env-file .env.telegram-bot up -d
📋 Configuration Files
.env.telegram-bot- Bot token and webhook URLdocker-compose.telegram-bot.yml- Docker configurationtelegram_trade_bot.py- Bot source code
🐛 Troubleshooting
Bot not responding?
docker logs telegram-trade-bot
Check if bot is running:
docker ps | grep telegram
Test webhook manually:
curl -X POST http://10.0.0.48:8098/webhook/manual-trade \
-H "Content-Type: application/json" \
-d '{"text": "buy sol"}'
Check n8n workflow:
- Is it activated?
- Is the webhook URL correct?
- Is it connected to Check Risk node?
✅ Supported Commands
From your phone, send any of these:
buy sol/buy btc/buy ethsell sol/sell btc/sell ethlong sol/short btc(same as buy/sell)
The bot extracts:
- Symbol: SOL, BTC, or ETH (defaults to SOL)
- Direction: sell/short = short position, anything else = long position
Commands are case-insensitive: BUY SOL, Buy Sol, buy sol all work!