# Settings Management Setup ## Initial Setup After deploying the trading bot, you need to make the `.env` file writable by the container: ```bash 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: 1. File system permissions (only accessible on the host) 2. Docker isolation (container runs as non-root user) 3. 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 1. User edits settings in web UI at http://10.0.0.48:3001/settings 2. Click "Save Settings" → API writes to `/app/.env` (mounted from host) 3. Click "Restart Bot" → Watcher restarts container 4. Container reloads settings from updated .env file 5. 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.