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:
mindesbunister
2025-10-27 12:59:25 +01:00
parent f8f289232a
commit 14d5de2c64
48 changed files with 37 additions and 14 deletions

View File

@@ -0,0 +1,110 @@
# Testing the /status Command
## ✅ Feature Implemented
The Telegram bot now supports the `/status` command to show current open positions.
## What It Shows
When you send `/status` in your Telegram chat, you'll receive:
### If No Positions Are Open:
```
📊 No open positions
All clear! Ready for new signals.
```
### If Position Is Open:
```
🟢 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
```
### Emojis Used:
- 🟢 Green = Position in profit
- 🔴 Red = Position in loss
- ⚪ White = Breakeven
- 📈 = Long position
- 📉 = Short position
- ✅ = Target hit
- ⏳ = Target pending
## Technical Details
### How It Works:
1. User sends `/status` in Telegram
2. Bot calls `GET /api/trading/positions` on trading-bot-v4:3000
3. Bot parses response and formats position data
4. Bot sends formatted message back to user
### Files Modified:
- `telegram_command_bot.py` - Added `status_command()` handler
- `docker-compose.telegram-bot.yml` - Added environment variables
- `.env.telegram-bot` - Added `TRADING_BOT_URL` and `API_SECRET_KEY`
### Environment Variables Required:
```bash
TRADING_BOT_URL=http://trading-bot-v4:3000
API_SECRET_KEY=<same as main .env file>
```
## Testing
### 1. Test from Terminal (API):
```bash
curl -H "Authorization: Bearer YOUR_API_SECRET_KEY" \
http://localhost:3001/api/trading/positions | jq .
```
### 2. Test from Telegram:
- Open your Telegram bot chat
- Send: `/status`
- Should receive position info or "No open positions"
### 3. Test with Active Position:
- Execute a test trade first:
- Send `/buySOL` or use settings page "Test LONG"
- Then send `/status`
- Should see full position details
## Verification
✅ Container running:
```bash
docker ps | grep telegram-trade-bot
```
✅ Logs showing /status handler:
```bash
docker logs telegram-trade-bot --tail 20
```
✅ Network connectivity:
```bash
docker exec telegram-trade-bot python3 -c "import requests; r=requests.get('http://trading-bot-v4:3000/api/trading/positions', headers={'Authorization': 'Bearer YOUR_KEY'}); print(r.status_code)"
```
Should output: `200`
## Next Steps
You can now monitor your positions in real-time from your phone!
Just send `/status` anytime to check:
- Current P&L
- How close you are to TP/SL
- How long the trade has been open