chore: Organize workspace structure - move docs, workflows, scripts to subdirectories
Organization: - Created docs/ with setup/, guides/, history/ subdirectories - Created workflows/ with trading/, analytics/, telegram/, archive/ subdirectories - Created scripts/ with docker/, setup/, testing/ subdirectories - Created tests/ for TypeScript test files - Created archive/ for unused reference files Moved files: - 17 documentation files → docs/ - 16 workflow JSON files → workflows/ - 10 shell scripts → scripts/ - 4 test files → tests/ - 5 unused files → archive/ Updated: - README.md with new file structure and documentation paths Deleted: - data/ (empty directory) - screenshots/ (empty directory) Critical files remain in root: - telegram_command_bot.py (active bot - used by Dockerfile) - watch-restart.sh (systemd service dependency) - All Dockerfiles and docker-compose files - All environment files Validation: Containers running (trading-bot-v4, telegram-trade-bot, postgres) API responding (positions endpoint tested) Telegram bot functional (/status command tested) All critical files present in root No code changes - purely organizational. System continues running without interruption. Recovery: git revert HEAD or git reset --hard cleanup-before
This commit is contained in:
151
docs/setup/TELEGRAM_BOT_README.md
Normal file
151
docs/setup/TELEGRAM_BOT_README.md
Normal file
@@ -0,0 +1,151 @@
|
||||
# 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
|
||||
```bash
|
||||
./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:
|
||||
1. ✅ Parse your message
|
||||
2. ✅ Forward to n8n webhook
|
||||
3. ✅ n8n sends to your trading bot
|
||||
4. ✅ Trade executes with risk checks
|
||||
5. ✅ You get confirmation in Telegram
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Management
|
||||
|
||||
**View logs:**
|
||||
```bash
|
||||
docker logs -f telegram-trade-bot
|
||||
```
|
||||
|
||||
**Restart bot:**
|
||||
```bash
|
||||
docker restart telegram-trade-bot
|
||||
```
|
||||
|
||||
**Stop bot:**
|
||||
```bash
|
||||
docker-compose -f docker-compose.telegram-bot.yml down
|
||||
```
|
||||
|
||||
**Start bot:**
|
||||
```bash
|
||||
docker-compose -f docker-compose.telegram-bot.yml --env-file .env.telegram-bot up -d
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 Configuration Files
|
||||
|
||||
- `.env.telegram-bot` - Bot token and webhook URL
|
||||
- `docker-compose.telegram-bot.yml` - Docker configuration
|
||||
- `telegram_trade_bot.py` - Bot source code
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
**Bot not responding?**
|
||||
```bash
|
||||
docker logs telegram-trade-bot
|
||||
```
|
||||
|
||||
**Check if bot is running:**
|
||||
```bash
|
||||
docker ps | grep telegram
|
||||
```
|
||||
|
||||
**Test webhook manually:**
|
||||
```bash
|
||||
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 eth`
|
||||
- `sell sol` / `sell btc` / `sell eth`
|
||||
- `long 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!
|
||||
Reference in New Issue
Block a user