refactor: reorganize project structure — consolidate Docker files, clean root
- Delete temp files: _tmp_analysis.py, nul, dashboard_screenshot.png - Move ea/ to archive/ea/ (deprecated) - Move 12 Docker helper scripts (.bat/.sh) to docker/scripts/ - Move 5 Docker docs to docker/docs/ - Move .env.docker.example, requirements-docker.txt to docker/ - Update all scripts with cd to project root for correct path resolution - Update all doc references to new paths - Update .gitignore with bot.pid, bot_output.log, *.png patterns - Update CLAUDE.md, README.md directory trees Root reduced from ~40 files to 12 essential files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -82,5 +82,10 @@ docker/data/
|
||||
# Archive
|
||||
archive/
|
||||
|
||||
# Junk
|
||||
# Runtime files
|
||||
bot.pid
|
||||
bot_output.log
|
||||
nul
|
||||
|
||||
# Screenshots
|
||||
*.png
|
||||
|
||||
@@ -10,6 +10,9 @@ XAUBot AI is an automated XAUUSD (Gold) trading bot that combines Machine Learni
|
||||
.
|
||||
├── main_live.py # Main async trading orchestrator
|
||||
├── train_models.py # Model training script
|
||||
├── Dockerfile # Docker image (must be at root)
|
||||
├── docker-compose.yml # Docker orchestration (must be at root)
|
||||
├── .dockerignore # Docker build exclusions (must be at root)
|
||||
├── src/ # Core modules
|
||||
│ ├── config.py # Trading configuration & capital modes
|
||||
│ ├── mt5_connector.py # MetaTrader 5 connection layer
|
||||
@@ -49,6 +52,12 @@ XAUBot AI is an automated XAUUSD (Gold) trading bot that combines Machine Learni
|
||||
│ └── research/ # Research & analysis files
|
||||
├── web-dashboard/ # Next.js monitoring dashboard
|
||||
├── docker/ # Docker configuration
|
||||
│ ├── .env.docker.example # Docker environment template
|
||||
│ ├── requirements-docker.txt # Docker-specific Python deps
|
||||
│ ├── init-db/ # Database init scripts
|
||||
│ ├── scripts/ # Docker helper scripts (.bat/.sh)
|
||||
│ └── docs/ # Docker documentation
|
||||
├── archive/ # Deprecated files (gitignored)
|
||||
└── logs/ # Runtime logs
|
||||
```
|
||||
|
||||
|
||||
@@ -103,7 +103,10 @@ xaubot-ai/
|
||||
│ ├── arsitektur-ai/ # Architecture docs (23 components)
|
||||
│ └── research/ # Research & analysis
|
||||
├── web-dashboard/ # Next.js monitoring dashboard
|
||||
└── docker/ # Docker configuration
|
||||
├── docker/ # Docker configuration & scripts
|
||||
│ ├── scripts/ # Helper scripts (.bat/.sh)
|
||||
│ └── docs/ # Docker documentation
|
||||
└── archive/ # Deprecated files (gitignored)
|
||||
```
|
||||
|
||||
## Backtest Results (Jan 2025 - Feb 2026)
|
||||
@@ -129,14 +132,14 @@ git clone https://github.com/GifariKemal/xaubot-ai.git
|
||||
cd xaubot-ai
|
||||
|
||||
# 2. Configure environment
|
||||
cp .env.docker.example .env
|
||||
cp docker/.env.docker.example .env
|
||||
# Edit .env with your MT5 credentials
|
||||
|
||||
# 3. Start all services (Windows)
|
||||
docker-start.bat
|
||||
docker\scripts\docker-start.bat
|
||||
|
||||
# 3. Start all services (Linux/Mac)
|
||||
./docker-start.sh
|
||||
./docker/scripts/docker-start.sh
|
||||
```
|
||||
|
||||
**Services will be available at:**
|
||||
@@ -145,7 +148,7 @@ docker-start.bat
|
||||
- 📚 API Docs: http://localhost:8000/docs
|
||||
- 🗄️ Database: localhost:5432
|
||||
|
||||
**Full Docker documentation:** See [DOCKER.md](DOCKER.md)
|
||||
**Full Docker documentation:** See [docker/docs/DOCKER.md](docker/docs/DOCKER.md)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Layanan baru yang ditambahkan:
|
||||
|
||||
```cmd
|
||||
# Tambahkan dashboard ke setup yang sudah ada
|
||||
docker-add-dashboard.bat
|
||||
docker\scripts\docker-add-dashboard.bat
|
||||
```
|
||||
|
||||
Script ini akan:
|
||||
@@ -57,7 +57,7 @@ Setelah services running:
|
||||
### Check Status
|
||||
```cmd
|
||||
# Lihat status semua services
|
||||
docker-status.bat
|
||||
docker\scripts\docker-status.bat
|
||||
|
||||
# Atau manual
|
||||
docker-compose ps
|
||||
@@ -90,7 +90,7 @@ docker-compose restart
|
||||
### Remove Dashboard (Keep Database)
|
||||
```cmd
|
||||
# Hapus dashboard tapi tetap keep database
|
||||
docker-remove-dashboard.bat
|
||||
docker\scripts\docker-remove-dashboard.bat
|
||||
|
||||
# Atau manual
|
||||
docker-compose stop trading-api dashboard
|
||||
@@ -230,12 +230,16 @@ xaubot-ai/
|
||||
├── Dockerfile # API image (NEW)
|
||||
├── .env # Environment config
|
||||
├── .dockerignore # Build exclusions
|
||||
├── docker-add-dashboard.bat # Add dashboard script (NEW)
|
||||
├── docker-remove-dashboard.bat # Remove dashboard script (NEW)
|
||||
├── docker-status.bat # Status check script (NEW)
|
||||
├── docker/
|
||||
│ └── init-db/
|
||||
│ └── 01-schema.sql # Database schema (EXISTING)
|
||||
│ ├── .env.docker.example # Environment template
|
||||
│ ├── requirements-docker.txt # Docker-specific deps
|
||||
│ ├── init-db/
|
||||
│ │ └── 01-schema.sql # Database schema (EXISTING)
|
||||
│ ├── scripts/ # Helper scripts
|
||||
│ │ ├── docker-add-dashboard.bat
|
||||
│ │ ├── docker-remove-dashboard.bat
|
||||
│ │ └── docker-status.bat
|
||||
│ └── docs/ # Docker documentation
|
||||
└── web-dashboard/
|
||||
├── Dockerfile # Dashboard image (NEW)
|
||||
└── .dockerignore # Build exclusions
|
||||
@@ -32,7 +32,7 @@
|
||||
- Clear documentation for each setting
|
||||
- Default values for non-sensitive configs
|
||||
|
||||
**Location:** `.env.docker.example`
|
||||
**Location:** `docker/.env.docker.example`
|
||||
|
||||
### 5. **Created Docker Ignore Files**
|
||||
- Excludes unnecessary files from images
|
||||
@@ -46,14 +46,14 @@
|
||||
### 6. **Created Helper Scripts**
|
||||
|
||||
#### Windows Batch Scripts:
|
||||
- `docker-start.bat` - Start all services
|
||||
- `docker-stop.bat` - Stop services with options
|
||||
- `docker-logs.bat` - View service logs
|
||||
- `docker\scripts\docker-start.bat` - Start all services
|
||||
- `docker\scripts\docker-stop.bat` - Stop services with options
|
||||
- `docker\scripts\docker-logs.bat` - View service logs
|
||||
|
||||
#### Linux/Mac Shell Scripts:
|
||||
- `docker-start.sh` - Start all services
|
||||
- `docker-stop.sh` - Stop services with options
|
||||
- `docker-logs.sh` - View service logs
|
||||
- `docker/scripts/docker-start.sh` - Start all services
|
||||
- `docker/scripts/docker-stop.sh` - Stop services with options
|
||||
- `docker/scripts/docker-logs.sh` - View service logs
|
||||
|
||||
### 7. **Updated Next.js Configuration**
|
||||
- Enabled standalone output for Docker
|
||||
@@ -122,7 +122,7 @@
|
||||
cd "Smart Automatic Trading BOT + AI"
|
||||
|
||||
# Create environment file
|
||||
copy .env.docker.example .env
|
||||
copy docker\.env.docker.example .env
|
||||
|
||||
# Edit .env with your MT5 credentials
|
||||
notepad .env
|
||||
@@ -141,10 +141,10 @@ MT5_PATH=/path/to/mt5/terminal
|
||||
**Option A: Using helper script (Recommended)**
|
||||
```cmd
|
||||
REM Start core services
|
||||
docker-start.bat
|
||||
docker\scripts\docker-start.bat
|
||||
|
||||
REM Or start with pgAdmin
|
||||
docker-start.bat --admin
|
||||
docker\scripts\docker-start.bat --admin
|
||||
```
|
||||
|
||||
**Option B: Manual docker-compose**
|
||||
@@ -182,12 +182,12 @@ You'll see:
|
||||
### View Logs
|
||||
```cmd
|
||||
REM All services
|
||||
docker-logs.bat
|
||||
docker\scripts\docker-logs.bat
|
||||
|
||||
REM Specific service
|
||||
docker-logs.bat trading-api
|
||||
docker-logs.bat dashboard
|
||||
docker-logs.bat postgres
|
||||
docker\scripts\docker-logs.bat trading-api
|
||||
docker\scripts\docker-logs.bat dashboard
|
||||
docker\scripts\docker-logs.bat postgres
|
||||
```
|
||||
|
||||
### Check Status
|
||||
@@ -208,13 +208,13 @@ docker-compose restart dashboard
|
||||
### Stop Services
|
||||
```cmd
|
||||
REM Stop (keeps data)
|
||||
docker-stop.bat
|
||||
docker\scripts\docker-stop.bat
|
||||
|
||||
REM Stop and remove containers (keeps data)
|
||||
docker-stop.bat --remove
|
||||
docker\scripts\docker-stop.bat --remove
|
||||
|
||||
REM Stop and remove everything including data (⚠️ DANGER!)
|
||||
docker-stop.bat --clean
|
||||
docker\scripts\docker-stop.bat --clean
|
||||
```
|
||||
|
||||
### Update Code and Rebuild
|
||||
@@ -263,7 +263,7 @@ curl http://localhost:8000/api/health
|
||||
|
||||
**View API logs:**
|
||||
```cmd
|
||||
docker-logs.bat trading-api
|
||||
docker\scripts\docker-logs.bat trading-api
|
||||
```
|
||||
|
||||
### Port Already in Use
|
||||
@@ -292,7 +292,7 @@ docker-compose up -d
|
||||
2. Ensure MT5 terminal is accessible
|
||||
3. View API logs for connection errors:
|
||||
```cmd
|
||||
docker-logs.bat trading-api
|
||||
docker\scripts\docker-logs.bat trading-api
|
||||
```
|
||||
|
||||
### Database Connection Issues
|
||||
@@ -309,7 +309,7 @@ docker exec -it trading_bot_db pg_isready -U trading_bot
|
||||
|
||||
**View database logs:**
|
||||
```cmd
|
||||
docker-logs.bat postgres
|
||||
docker\scripts\docker-logs.bat postgres
|
||||
```
|
||||
|
||||
## 📊 Monitoring
|
||||
@@ -353,15 +353,27 @@ xaubot-ai/
|
||||
├── Dockerfile # Python API Docker image
|
||||
├── docker-compose.yml # Service orchestration
|
||||
├── .env # Environment variables (DO NOT COMMIT)
|
||||
├── .env.docker.example # Environment template
|
||||
├── .dockerignore # Files to exclude from build
|
||||
├── docker-start.bat # Windows start script
|
||||
├── docker-stop.bat # Windows stop script
|
||||
├── docker-logs.bat # Windows logs script
|
||||
├── docker-start.sh # Linux/Mac start script
|
||||
├── docker-stop.sh # Linux/Mac stop script
|
||||
├── docker-logs.sh # Linux/Mac logs script
|
||||
├── DOCKER.md # Full Docker documentation
|
||||
├── docker/
|
||||
│ ├── .env.docker.example # Environment template
|
||||
│ ├── requirements-docker.txt # Docker-specific Python deps
|
||||
│ ├── init-db/01-schema.sql # Database schema
|
||||
│ ├── scripts/ # Helper scripts
|
||||
│ │ ├── docker-start.bat/.sh
|
||||
│ │ ├── docker-stop.bat/.sh
|
||||
│ │ ├── docker-logs.bat/.sh
|
||||
│ │ ├── docker-status.bat
|
||||
│ │ ├── docker-add-dashboard.bat
|
||||
│ │ ├── docker-remove-dashboard.bat
|
||||
│ │ ├── start-all.bat
|
||||
│ │ ├── start-api.bat
|
||||
│ │ └── start-dashboard.bat
|
||||
│ └── docs/ # Docker documentation
|
||||
│ ├── DOCKER.md
|
||||
│ ├── DOCKER-INTEGRATION.md
|
||||
│ ├── DOCKER-SETUP-SUMMARY.md
|
||||
│ ├── QUICK-START.md
|
||||
│ └── SIMPLE-START.md
|
||||
└── web-dashboard/
|
||||
├── Dockerfile # Next.js dashboard image
|
||||
├── .dockerignore # Dashboard build exclusions
|
||||
@@ -390,7 +402,7 @@ xaubot-ai/
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. Check the logs: `docker-logs.bat`
|
||||
1. Check the logs: `docker\scripts\docker-logs.bat`
|
||||
2. Verify services: `docker-compose ps`
|
||||
3. Review troubleshooting section in [DOCKER.md](DOCKER.md)
|
||||
4. Check service health: `curl http://localhost:8000/api/health`
|
||||
@@ -51,7 +51,7 @@ The Docker setup includes 4 services:
|
||||
cd "Smart Automatic Trading BOT + AI"
|
||||
|
||||
# Copy environment template
|
||||
cp .env.docker.example .env
|
||||
cp docker/.env.docker.example .env
|
||||
```
|
||||
|
||||
### 2. Configure Environment
|
||||
@@ -14,7 +14,7 @@
|
||||
cd "C:\Users\Administrator\Videos\Smart Automatic Trading BOT + AI"
|
||||
|
||||
REM Copy environment template kalau belum ada
|
||||
copy .env.docker.example .env
|
||||
copy docker\.env.docker.example .env
|
||||
|
||||
REM Edit dengan MT5 credentials Anda
|
||||
notepad .env
|
||||
@@ -148,7 +148,7 @@ Docker Compose Project: "smart-automatic-trading-bot-ai"
|
||||
|
||||
## ✅ Checklist
|
||||
|
||||
- [ ] Copy `.env.docker.example` ke `.env`
|
||||
- [ ] Copy `docker/.env.docker.example` ke `.env`
|
||||
- [ ] Edit `.env` dengan MT5 credentials
|
||||
- [ ] Run: `docker-compose build trading-api dashboard`
|
||||
- [ ] Run: `docker-compose up -d trading-api dashboard`
|
||||
@@ -3,7 +3,7 @@
|
||||
## 🎯 Cara Tercepat (1 Command)
|
||||
|
||||
```cmd
|
||||
start-all.bat
|
||||
docker\scripts\start-all.bat
|
||||
```
|
||||
|
||||
Script ini akan:
|
||||
@@ -17,19 +17,19 @@ Dua window akan terbuka otomatis!
|
||||
|
||||
### Option 1: Start Semua Sekaligus
|
||||
```cmd
|
||||
start-all.bat
|
||||
docker\scripts\start-all.bat
|
||||
```
|
||||
|
||||
### Option 2: Start Satu-satu
|
||||
|
||||
**Terminal 1: API**
|
||||
```cmd
|
||||
start-api.bat
|
||||
docker\scripts\start-api.bat
|
||||
```
|
||||
|
||||
**Terminal 2: Dashboard**
|
||||
```cmd
|
||||
start-dashboard.bat
|
||||
docker\scripts\start-dashboard.bat
|
||||
```
|
||||
|
||||
## ✅ Pre-requisites
|
||||
@@ -155,16 +155,16 @@ Dashboard akan menampilkan:
|
||||
Lihat output di command windows untuk debug
|
||||
|
||||
4. **Quick Restart:**
|
||||
Close windows dan run `start-all.bat` lagi
|
||||
Close windows dan run `docker\scripts\start-all.bat` lagi
|
||||
|
||||
## 📝 Files
|
||||
|
||||
```
|
||||
start-all.bat # Start API + Dashboard
|
||||
start-api.bat # Start API only
|
||||
start-dashboard.bat # Start Dashboard only
|
||||
docker\scripts\start-all.bat # Start API + Dashboard
|
||||
docker\scripts\start-api.bat # Start API only
|
||||
docker\scripts\start-dashboard.bat # Start Dashboard only
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Super Simple!** Tinggal double-click `start-all.bat` 🎉
|
||||
**Super Simple!** Tinggal double-click `docker\scripts\start-all.bat` 🎉
|
||||
@@ -1,5 +1,6 @@
|
||||
@echo off
|
||||
REM Add Dashboard & API to existing Docker setup
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
@@ -11,7 +12,7 @@ REM Check if .env exists
|
||||
if not exist .env (
|
||||
echo WARNING: .env file not found!
|
||||
echo Creating .env from template...
|
||||
copy .env.docker.example .env
|
||||
copy docker\.env.docker.example .env
|
||||
echo.
|
||||
echo Please edit .env with your MT5 credentials:
|
||||
echo - MT5_LOGIN
|
||||
@@ -1,5 +1,6 @@
|
||||
@echo off
|
||||
REM XAUBot AI - Docker Logs Viewer (Windows)
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
set SERVICE=%1
|
||||
set LINES=%2
|
||||
@@ -2,6 +2,7 @@
|
||||
# XAUBot AI - Docker Logs Viewer
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
SERVICE="$1"
|
||||
LINES="${2:-100}"
|
||||
@@ -1,5 +1,6 @@
|
||||
@echo off
|
||||
REM Remove Dashboard & API while keeping database
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
@@ -29,6 +30,6 @@ echo.
|
||||
echo Database is still running:
|
||||
docker ps --filter "name=trading_bot_db" --format "table {{.Names}}\t{{.Status}}"
|
||||
echo.
|
||||
echo To add dashboard back: docker-add-dashboard.bat
|
||||
echo To add dashboard back: docker\scripts\docker-add-dashboard.bat
|
||||
echo.
|
||||
pause
|
||||
@@ -1,5 +1,6 @@
|
||||
@echo off
|
||||
REM XAUBot AI - Docker Start Script (Windows)
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo Starting XAUBot AI Docker Services...
|
||||
@@ -9,7 +10,7 @@ REM Check if .env exists
|
||||
if not exist .env (
|
||||
echo WARNING: .env file not found!
|
||||
echo Creating .env from template...
|
||||
copy .env.docker.example .env
|
||||
copy docker\.env.docker.example .env
|
||||
echo.
|
||||
echo .env created. Please edit it with your MT5 credentials:
|
||||
echo - MT5_LOGIN
|
||||
@@ -86,6 +87,6 @@ echo View API logs: docker-compose logs -f trading-api
|
||||
echo Stop services: docker-compose down
|
||||
echo Restart: docker-compose restart
|
||||
echo.
|
||||
echo Full documentation: DOCKER.md
|
||||
echo Full documentation: docker\docs\DOCKER.md
|
||||
echo.
|
||||
pause
|
||||
@@ -2,6 +2,7 @@
|
||||
# XAUBot AI - Docker Start Script
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
echo "🚀 Starting XAUBot AI Docker Services..."
|
||||
echo ""
|
||||
@@ -10,7 +11,7 @@ echo ""
|
||||
if [ ! -f .env ]; then
|
||||
echo "⚠️ .env file not found!"
|
||||
echo "📝 Creating .env from template..."
|
||||
cp .env.docker.example .env
|
||||
cp docker/.env.docker.example .env
|
||||
echo "✅ .env created. Please edit it with your MT5 credentials:"
|
||||
echo " - MT5_LOGIN"
|
||||
echo " - MT5_PASSWORD"
|
||||
@@ -83,5 +84,5 @@ echo " View API logs: docker-compose logs -f trading-api"
|
||||
echo " Stop services: docker-compose down"
|
||||
echo " Restart: docker-compose restart"
|
||||
echo ""
|
||||
echo "📖 Full documentation: DOCKER.md"
|
||||
echo "📖 Full documentation: docker/docs/DOCKER.md"
|
||||
echo ""
|
||||
@@ -1,5 +1,6 @@
|
||||
@echo off
|
||||
REM Check status of all trading bot services
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
@@ -1,5 +1,6 @@
|
||||
@echo off
|
||||
REM XAUBot AI - Docker Stop Script (Windows)
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo Stopping XAUBot AI Docker Services...
|
||||
@@ -39,6 +40,6 @@ echo Containers stopped
|
||||
|
||||
:end
|
||||
echo.
|
||||
echo To restart: docker-start.bat
|
||||
echo To restart: docker\scripts\docker-start.bat
|
||||
echo.
|
||||
pause
|
||||
@@ -2,6 +2,7 @@
|
||||
# XAUBot AI - Docker Stop Script
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
echo "🛑 Stopping XAUBot AI Docker Services..."
|
||||
echo ""
|
||||
@@ -27,5 +28,5 @@ else
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📋 To restart: ./docker-start.sh"
|
||||
echo "📋 To restart: ./docker/scripts/docker-start.sh"
|
||||
echo ""
|
||||
@@ -7,7 +7,7 @@ echo XAUBot AI - Starting All Services
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
cd "%~dp0"
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
REM Check database
|
||||
echo [1/3] Checking database...
|
||||
@@ -23,14 +23,14 @@ if errorlevel 1 (
|
||||
|
||||
echo.
|
||||
echo [2/3] Starting API...
|
||||
start "Trading API" cmd /k start-api.bat
|
||||
start "Trading API" cmd /k docker\scripts\start-api.bat
|
||||
|
||||
echo Waiting for API to start...
|
||||
timeout /t 5 /nobreak >nul
|
||||
|
||||
echo.
|
||||
echo [3/3] Starting Dashboard...
|
||||
start "Web Dashboard" cmd /k start-dashboard.bat
|
||||
start "Web Dashboard" cmd /k docker\scripts\start-dashboard.bat
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
@@ -7,7 +7,7 @@ echo Starting Trading API
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
cd "%~dp0"
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
REM Check if virtual environment exists
|
||||
if not exist "venv" (
|
||||
@@ -7,7 +7,7 @@ echo Starting Web Dashboard
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
cd "%~dp0web-dashboard"
|
||||
cd /d "%~dp0..\..\web-dashboard"
|
||||
|
||||
REM Check if node_modules exists
|
||||
if not exist "node_modules" (
|
||||
Reference in New Issue
Block a user