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
2.1 KiB
2.1 KiB
Settings Management Setup
Initial Setup
After deploying the trading bot, you need to make the .env file writable by the container:
chmod 666 /home/icke/traderv4/.env
This allows the web UI to save settings changes directly to the .env file.
Security Note
The .env file contains sensitive information (private keys, API keys). The file permissions of 666 (rw-rw-rw-) allow the containerized application to write settings, but the file is still protected by:
- File system permissions (only accessible on the host)
- Docker isolation (container runs as non-root user)
- Network isolation (not exposed to internet)
For production environments, consider:
- Using secrets management (e.g., Docker secrets, Kubernetes secrets)
- Environment variable injection from secure vaults
- Read-only .env with separate settings database
How It Works
- User edits settings in web UI at http://10.0.0.48:3001/settings
- Click "Save Settings" → API writes to
/app/.env(mounted from host) - Click "Restart Bot" → Watcher restarts container
- Container reloads settings from updated .env file
- New configuration takes effect
Take Profit Configuration
You can now customize BOTH the price level AND the position size for each TP:
TP1 (Take Profit 1)
- Price %: When to trigger the exit (e.g., +0.7% = exit at 0.7% profit)
- Size %: What % of position to close (e.g., 60 = close 60% of position)
TP2 (Take Profit 2)
- Price %: When to trigger the second exit (e.g., +1.5% = exit at 1.5% profit)
- Size %: What % of REMAINING position to close (e.g., 100 = close rest)
Example Strategy
Conservative (70/30 split):
- TP1: +0.5% price, 70% size → Lock in most profit early
- TP2: +2.0% price, 30% size → Let remainder run
Aggressive (30/70 split):
- TP1: +1.0% price, 30% size → Take small profit
- TP2: +3.0% price, 70% size → Let most position run for bigger gains
Balanced (50/50 split - default):
- TP1: +0.7% price, 50% size
- TP2: +1.5% price, 50% size
The risk calculator in the web UI will dynamically show expected gains based on your settings.