mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-02 01:27:24 -04:00
Compare commits
1 Commits
v0.2.0-alp
...
v0.2.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f2c1d6ea2 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -57,6 +57,7 @@ delete.py
|
||||
refresh_data.sh
|
||||
|
||||
# Config files (optional - uncomment if needed)
|
||||
configs/custom_config.json
|
||||
configs/day_config.json
|
||||
configs/hour_config.json
|
||||
configs/test_config.json
|
||||
|
||||
@@ -7,6 +7,7 @@ services:
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
- ./logs:/app/logs
|
||||
- ./configs:/app/configs
|
||||
environment:
|
||||
# AI Model API Configuration
|
||||
- OPENAI_API_BASE=${OPENAI_API_BASE}
|
||||
|
||||
@@ -53,10 +53,30 @@ AGENT_MAX_STEP=30
|
||||
|
||||
### Custom Trading Configuration
|
||||
|
||||
Pass a custom config file:
|
||||
**Simple Method (Recommended):**
|
||||
|
||||
Create a `configs/custom_config.json` file - it will be automatically used:
|
||||
|
||||
```bash
|
||||
docker-compose run ai-trader configs/my_config.json
|
||||
# Copy default config as starting point
|
||||
cp configs/default_config.json configs/custom_config.json
|
||||
|
||||
# Edit your custom config
|
||||
nano configs/custom_config.json
|
||||
|
||||
# Run normally - custom_config.json is automatically detected!
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
**Priority order:**
|
||||
1. `configs/custom_config.json` (if exists) - **Highest priority**
|
||||
2. Command-line argument: `docker-compose run ai-trader configs/other.json`
|
||||
3. `configs/default_config.json` (fallback)
|
||||
|
||||
**Advanced: Use a different config file name:**
|
||||
|
||||
```bash
|
||||
docker-compose run ai-trader configs/my_special_config.json
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
@@ -92,10 +112,11 @@ docker-compose up
|
||||
|
||||
### Volume Mounts
|
||||
|
||||
Docker Compose mounts two volumes:
|
||||
Docker Compose mounts three volumes:
|
||||
|
||||
- `./data:/app/data` - Price data and trading records
|
||||
- `./logs:/app/logs` - MCP service logs
|
||||
- `./configs:/app/configs` - Configuration files (allows editing configs without rebuilding)
|
||||
|
||||
Data persists across container restarts. To reset:
|
||||
|
||||
@@ -227,13 +248,45 @@ Services exposed on host:
|
||||
|
||||
### Test Different Configurations
|
||||
|
||||
```bash
|
||||
# Create test config
|
||||
cp configs/default_config.json configs/test_config.json
|
||||
# Edit test_config.json
|
||||
**Method 1: Use the standard custom_config.json**
|
||||
|
||||
# Run with test config
|
||||
docker-compose run ai-trader configs/test_config.json
|
||||
```bash
|
||||
# Create and edit your config
|
||||
cp configs/default_config.json configs/custom_config.json
|
||||
nano configs/custom_config.json
|
||||
|
||||
# Run - automatically uses custom_config.json
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
**Method 2: Test multiple configs with different names**
|
||||
|
||||
```bash
|
||||
# Create multiple test configs
|
||||
cp configs/default_config.json configs/conservative.json
|
||||
cp configs/default_config.json configs/aggressive.json
|
||||
|
||||
# Edit each config...
|
||||
|
||||
# Test conservative strategy
|
||||
docker-compose run ai-trader configs/conservative.json
|
||||
|
||||
# Test aggressive strategy
|
||||
docker-compose run ai-trader configs/aggressive.json
|
||||
```
|
||||
|
||||
**Method 3: Temporarily switch configs**
|
||||
|
||||
```bash
|
||||
# Temporarily rename your custom config
|
||||
mv configs/custom_config.json configs/custom_config.json.backup
|
||||
cp configs/test_strategy.json configs/custom_config.json
|
||||
|
||||
# Run with test strategy
|
||||
docker-compose up
|
||||
|
||||
# Restore original
|
||||
mv configs/custom_config.json.backup configs/custom_config.json
|
||||
```
|
||||
|
||||
## Production Deployment
|
||||
|
||||
@@ -57,7 +57,19 @@ sleep 3
|
||||
|
||||
# Step 4: Run trading agent with config file
|
||||
echo "🤖 Starting trading agent..."
|
||||
CONFIG_FILE="${1:-configs/default_config.json}"
|
||||
|
||||
# Smart config selection: custom_config.json takes precedence if it exists
|
||||
if [ -f "configs/custom_config.json" ]; then
|
||||
CONFIG_FILE="configs/custom_config.json"
|
||||
echo "✅ Using custom configuration: configs/custom_config.json"
|
||||
elif [ -n "$1" ]; then
|
||||
CONFIG_FILE="$1"
|
||||
echo "✅ Using specified configuration: $CONFIG_FILE"
|
||||
else
|
||||
CONFIG_FILE="configs/default_config.json"
|
||||
echo "✅ Using default configuration: configs/default_config.json"
|
||||
fi
|
||||
|
||||
python main.py "$CONFIG_FILE"
|
||||
|
||||
# Cleanup on exit
|
||||
|
||||
Reference in New Issue
Block a user