mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-11 21:17:25 -04:00
docs: update user-guide docs for AI-Trader-Server rebrand
Update all user-guide documentation files: - configuration.md: Update title and container name references - using-the-api.md: Update title - integration-examples.md: Update title, class names (AsyncAITraderServerClient), container names, DAG names, and log paths - troubleshooting.md: Update title, container names (ai-trader to ai-trader-server), GitHub issues URL All Docker commands and code examples now reference ai-trader-server container name. Part of Phase 3: Developer & Deployment Documentation
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Configuration Guide
|
# Configuration Guide
|
||||||
|
|
||||||
Complete guide to configuring AI-Trader.
|
Complete guide to configuring AI-Trader-Server.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -323,5 +323,5 @@ docker-compose up -d
|
|||||||
curl http://localhost:8080/health
|
curl http://localhost:8080/health
|
||||||
|
|
||||||
# Check logs for errors
|
# Check logs for errors
|
||||||
docker logs ai-trader | grep -i error
|
docker logs ai-trader-server | grep -i error
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Integration Examples
|
# Integration Examples
|
||||||
|
|
||||||
Examples for integrating AI-Trader with external systems.
|
Examples for integrating AI-Trader-Server with external systems.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ See complete Python client in [API_REFERENCE.md](../../API_REFERENCE.md#client-l
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
class AsyncAITraderClient:
|
class AsyncAITraderServerClient:
|
||||||
def __init__(self, base_url="http://localhost:8080"):
|
def __init__(self, base_url="http://localhost:8080"):
|
||||||
self.base_url = base_url
|
self.base_url = base_url
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ class AsyncAITraderClient:
|
|||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
async def main():
|
async def main():
|
||||||
client = AsyncAITraderClient()
|
client = AsyncAITraderServerClient()
|
||||||
job = await client.trigger_simulation("2025-01-16", models=["gpt-4"])
|
job = await client.trigger_simulation("2025-01-16", models=["gpt-4"])
|
||||||
result = await client.wait_for_completion(job["job_id"])
|
result = await client.wait_for_completion(job["job_id"])
|
||||||
print(f"Simulation completed: {result['status']}")
|
print(f"Simulation completed: {result['status']}")
|
||||||
@@ -104,7 +104,7 @@ echo "Results saved to results_$DATE.json"
|
|||||||
|
|
||||||
Add to crontab:
|
Add to crontab:
|
||||||
```bash
|
```bash
|
||||||
0 6 * * * /path/to/daily_simulation.sh >> /var/log/ai-trader.log 2>&1
|
0 6 * * * /path/to/daily_simulation.sh >> /var/log/ai-trader-server.log 2>&1
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -120,7 +120,7 @@ import time
|
|||||||
|
|
||||||
def trigger_simulation(**context):
|
def trigger_simulation(**context):
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
"http://ai-trader:8080/simulate/trigger",
|
"http://ai-trader-server:8080/simulate/trigger",
|
||||||
json={"start_date": "{{ ds }}", "models": ["gpt-4"]}
|
json={"start_date": "{{ ds }}", "models": ["gpt-4"]}
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
@@ -130,7 +130,7 @@ def wait_for_completion(**context):
|
|||||||
job_id = context["task_instance"].xcom_pull(task_ids="trigger")
|
job_id = context["task_instance"].xcom_pull(task_ids="trigger")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
response = requests.get(f"http://ai-trader:8080/simulate/status/{job_id}")
|
response = requests.get(f"http://ai-trader-server:8080/simulate/status/{job_id}")
|
||||||
status = response.json()
|
status = response.json()
|
||||||
|
|
||||||
if status["status"] in ["completed", "partial", "failed"]:
|
if status["status"] in ["completed", "partial", "failed"]:
|
||||||
@@ -140,7 +140,7 @@ def wait_for_completion(**context):
|
|||||||
|
|
||||||
def fetch_results(**context):
|
def fetch_results(**context):
|
||||||
job_id = context["task_instance"].xcom_pull(task_ids="trigger")
|
job_id = context["task_instance"].xcom_pull(task_ids="trigger")
|
||||||
response = requests.get(f"http://ai-trader:8080/results?job_id={job_id}")
|
response = requests.get(f"http://ai-trader-server:8080/results?job_id={job_id}")
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
default_args = {
|
default_args = {
|
||||||
@@ -152,7 +152,7 @@ default_args = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dag = DAG(
|
dag = DAG(
|
||||||
"ai_trader_simulation",
|
"ai_trader_server_simulation",
|
||||||
default_args=default_args,
|
default_args=default_args,
|
||||||
schedule_interval="0 6 * * *", # Daily at 6 AM
|
schedule_interval="0 6 * * *", # Daily at 6 AM
|
||||||
catchup=False
|
catchup=False
|
||||||
@@ -183,7 +183,7 @@ trigger_task >> wait_task >> fetch_task
|
|||||||
|
|
||||||
## Generic Workflow Automation
|
## Generic Workflow Automation
|
||||||
|
|
||||||
Any HTTP-capable automation service can integrate with AI-Trader:
|
Any HTTP-capable automation service can integrate with AI-Trader-Server:
|
||||||
|
|
||||||
1. **Trigger:** POST to `/simulate/trigger`
|
1. **Trigger:** POST to `/simulate/trigger`
|
||||||
2. **Poll:** GET `/simulate/status/{job_id}` every 10-30 seconds
|
2. **Poll:** GET `/simulate/status/{job_id}` every 10-30 seconds
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Troubleshooting Guide
|
# Troubleshooting Guide
|
||||||
|
|
||||||
Common issues and solutions for AI-Trader.
|
Common issues and solutions for AI-Trader-Server.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -9,16 +9,16 @@ Common issues and solutions for AI-Trader.
|
|||||||
### Container Won't Start
|
### Container Won't Start
|
||||||
|
|
||||||
**Symptoms:**
|
**Symptoms:**
|
||||||
- `docker ps` shows no ai-trader container
|
- `docker ps` shows no ai-trader-server container
|
||||||
- Container exits immediately after starting
|
- Container exits immediately after starting
|
||||||
|
|
||||||
**Debug:**
|
**Debug:**
|
||||||
```bash
|
```bash
|
||||||
# Check logs
|
# Check logs
|
||||||
docker logs ai-trader
|
docker logs ai-trader-server
|
||||||
|
|
||||||
# Check if container exists (stopped)
|
# Check if container exists (stopped)
|
||||||
docker ps -a | grep ai-trader
|
docker ps -a | grep ai-trader-server
|
||||||
```
|
```
|
||||||
|
|
||||||
**Common Causes & Solutions:**
|
**Common Causes & Solutions:**
|
||||||
@@ -64,10 +64,10 @@ chmod -R 755 data logs configs
|
|||||||
**Debug:**
|
**Debug:**
|
||||||
```bash
|
```bash
|
||||||
# Check if API process is running
|
# Check if API process is running
|
||||||
docker exec ai-trader ps aux | grep uvicorn
|
docker exec ai-trader-server ps aux | grep uvicorn
|
||||||
|
|
||||||
# Test internal health (always port 8080 inside container)
|
# Test internal health (always port 8080 inside container)
|
||||||
docker exec ai-trader curl http://localhost:8080/health
|
docker exec ai-trader-server curl http://localhost:8080/health
|
||||||
|
|
||||||
# Check configured port
|
# Check configured port
|
||||||
grep API_PORT .env
|
grep API_PORT .env
|
||||||
@@ -82,7 +82,7 @@ Another service is using your configured port.
|
|||||||
# Find conflicting service
|
# Find conflicting service
|
||||||
sudo lsof -i :8080
|
sudo lsof -i :8080
|
||||||
|
|
||||||
# Change AI-Trader port
|
# Change AI-Trader-Server port
|
||||||
echo "API_PORT=8889" >> .env
|
echo "API_PORT=8889" >> .env
|
||||||
docker-compose down
|
docker-compose down
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
@@ -94,7 +94,7 @@ curl http://localhost:8889/health
|
|||||||
**If MCP services didn't start:**
|
**If MCP services didn't start:**
|
||||||
```bash
|
```bash
|
||||||
# Check MCP processes
|
# Check MCP processes
|
||||||
docker exec ai-trader ps aux | grep python
|
docker exec ai-trader-server ps aux | grep python
|
||||||
|
|
||||||
# Should see 4 MCP services on ports 8000-8003
|
# Should see 4 MCP services on ports 8000-8003
|
||||||
```
|
```
|
||||||
@@ -102,7 +102,7 @@ docker exec ai-trader ps aux | grep python
|
|||||||
**If database issues:**
|
**If database issues:**
|
||||||
```bash
|
```bash
|
||||||
# Check database file
|
# Check database file
|
||||||
docker exec ai-trader ls -l /app/data/jobs.db
|
docker exec ai-trader-server ls -l /app/data/jobs.db
|
||||||
|
|
||||||
# If missing, restart to recreate
|
# If missing, restart to recreate
|
||||||
docker-compose restart
|
docker-compose restart
|
||||||
@@ -121,13 +121,13 @@ docker-compose restart
|
|||||||
**Debug:**
|
**Debug:**
|
||||||
```bash
|
```bash
|
||||||
# Check worker logs
|
# Check worker logs
|
||||||
docker logs ai-trader | grep -i "worker\|simulation"
|
docker logs ai-trader-server | grep -i "worker\|simulation"
|
||||||
|
|
||||||
# Check database
|
# Check database
|
||||||
docker exec ai-trader sqlite3 /app/data/jobs.db "SELECT * FROM job_details;"
|
docker exec ai-trader-server sqlite3 /app/data/jobs.db "SELECT * FROM job_details;"
|
||||||
|
|
||||||
# Check MCP service accessibility
|
# Check MCP service accessibility
|
||||||
docker exec ai-trader curl http://localhost:8000/health
|
docker exec ai-trader-server curl http://localhost:8000/health
|
||||||
```
|
```
|
||||||
|
|
||||||
**Solutions:**
|
**Solutions:**
|
||||||
@@ -173,7 +173,7 @@ done
|
|||||||
**Check if agent is stuck:**
|
**Check if agent is stuck:**
|
||||||
```bash
|
```bash
|
||||||
# View real-time logs
|
# View real-time logs
|
||||||
docker logs -f ai-trader
|
docker logs -f ai-trader-server
|
||||||
|
|
||||||
# Look for repeated errors or infinite loops
|
# Look for repeated errors or infinite loops
|
||||||
```
|
```
|
||||||
@@ -204,7 +204,7 @@ curl -X POST http://localhost:8080/simulate/trigger \
|
|||||||
**Option 2: Manually Download Data**
|
**Option 2: Manually Download Data**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker exec -it ai-trader bash
|
docker exec -it ai-trader-server bash
|
||||||
cd data
|
cd data
|
||||||
python get_daily_price.py # Downloads latest data
|
python get_daily_price.py # Downloads latest data
|
||||||
python merge_jsonl.py # Merges into database
|
python merge_jsonl.py # Merges into database
|
||||||
@@ -242,7 +242,7 @@ grep AUTO_DOWNLOAD_PRICE_DATA .env
|
|||||||
**Workaround:**
|
**Workaround:**
|
||||||
```bash
|
```bash
|
||||||
# Pre-download data in batches
|
# Pre-download data in batches
|
||||||
docker exec -it ai-trader bash
|
docker exec -it ai-trader-server bash
|
||||||
cd data
|
cd data
|
||||||
|
|
||||||
# Download in stages (wait 1 min between runs)
|
# Download in stages (wait 1 min between runs)
|
||||||
@@ -269,7 +269,7 @@ exit
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Cause:** AI-Trader allows only 1 concurrent job by default.
|
**Cause:** AI-Trader-Server allows only 1 concurrent job by default.
|
||||||
|
|
||||||
**Solutions:**
|
**Solutions:**
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ exit
|
|||||||
curl http://localhost:8080/health # Verify API is up
|
curl http://localhost:8080/health # Verify API is up
|
||||||
|
|
||||||
# Query recent jobs (need to check database)
|
# Query recent jobs (need to check database)
|
||||||
docker exec ai-trader sqlite3 /app/data/jobs.db \
|
docker exec ai-trader-server sqlite3 /app/data/jobs.db \
|
||||||
"SELECT job_id, status FROM jobs ORDER BY created_at DESC LIMIT 5;"
|
"SELECT job_id, status FROM jobs ORDER BY created_at DESC LIMIT 5;"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ curl http://localhost:8080/simulate/status/{job_id}
|
|||||||
**Force-stop stuck job (last resort):**
|
**Force-stop stuck job (last resort):**
|
||||||
```bash
|
```bash
|
||||||
# Update job status in database
|
# Update job status in database
|
||||||
docker exec ai-trader sqlite3 /app/data/jobs.db \
|
docker exec ai-trader-server sqlite3 /app/data/jobs.db \
|
||||||
"UPDATE jobs SET status='failed' WHERE status IN ('pending', 'running');"
|
"UPDATE jobs SET status='failed' WHERE status IN ('pending', 'running');"
|
||||||
|
|
||||||
# Restart service
|
# Restart service
|
||||||
@@ -386,7 +386,7 @@ docker-compose up -d
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Re-download price data
|
# Re-download price data
|
||||||
docker exec -it ai-trader bash
|
docker exec -it ai-trader-server bash
|
||||||
cd data
|
cd data
|
||||||
python get_daily_price.py
|
python get_daily_price.py
|
||||||
python merge_jsonl.py
|
python merge_jsonl.py
|
||||||
@@ -418,7 +418,7 @@ exit
|
|||||||
**3. MCP services overloaded**
|
**3. MCP services overloaded**
|
||||||
```bash
|
```bash
|
||||||
# Check CPU usage
|
# Check CPU usage
|
||||||
docker stats ai-trader
|
docker stats ai-trader-server
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -430,7 +430,7 @@ docker stats ai-trader
|
|||||||
**If higher:**
|
**If higher:**
|
||||||
```bash
|
```bash
|
||||||
# Check memory
|
# Check memory
|
||||||
docker stats ai-trader
|
docker stats ai-trader-server
|
||||||
|
|
||||||
# Restart if needed
|
# Restart if needed
|
||||||
docker-compose restart
|
docker-compose restart
|
||||||
@@ -442,34 +442,34 @@ docker-compose restart
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Container status
|
# Container status
|
||||||
docker ps | grep ai-trader
|
docker ps | grep ai-trader-server
|
||||||
|
|
||||||
# Real-time logs
|
# Real-time logs
|
||||||
docker logs -f ai-trader
|
docker logs -f ai-trader-server
|
||||||
|
|
||||||
# Check errors only
|
# Check errors only
|
||||||
docker logs ai-trader 2>&1 | grep -i error
|
docker logs ai-trader-server 2>&1 | grep -i error
|
||||||
|
|
||||||
# Container resource usage
|
# Container resource usage
|
||||||
docker stats ai-trader
|
docker stats ai-trader-server
|
||||||
|
|
||||||
# Access container shell
|
# Access container shell
|
||||||
docker exec -it ai-trader bash
|
docker exec -it ai-trader-server bash
|
||||||
|
|
||||||
# Database inspection
|
# Database inspection
|
||||||
docker exec -it ai-trader sqlite3 /app/data/jobs.db
|
docker exec -it ai-trader-server sqlite3 /app/data/jobs.db
|
||||||
sqlite> SELECT * FROM jobs ORDER BY created_at DESC LIMIT 5;
|
sqlite> SELECT * FROM jobs ORDER BY created_at DESC LIMIT 5;
|
||||||
sqlite> SELECT status, COUNT(*) FROM jobs GROUP BY status;
|
sqlite> SELECT status, COUNT(*) FROM jobs GROUP BY status;
|
||||||
sqlite> .quit
|
sqlite> .quit
|
||||||
|
|
||||||
# Check file permissions
|
# Check file permissions
|
||||||
docker exec ai-trader ls -la /app/data
|
docker exec ai-trader-server ls -la /app/data
|
||||||
|
|
||||||
# Test API connectivity
|
# Test API connectivity
|
||||||
curl -v http://localhost:8080/health
|
curl -v http://localhost:8080/health
|
||||||
|
|
||||||
# View all environment variables
|
# View all environment variables
|
||||||
docker exec ai-trader env | sort
|
docker exec ai-trader-server env | sort
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -480,7 +480,7 @@ If your issue isn't covered here:
|
|||||||
|
|
||||||
1. **Check logs** for specific error messages
|
1. **Check logs** for specific error messages
|
||||||
2. **Review** [API_REFERENCE.md](../../API_REFERENCE.md) for correct usage
|
2. **Review** [API_REFERENCE.md](../../API_REFERENCE.md) for correct usage
|
||||||
3. **Search** [GitHub Issues](https://github.com/Xe138/AI-Trader/issues)
|
3. **Search** [GitHub Issues](https://github.com/Xe138/AI-Trader-Server/issues)
|
||||||
4. **Open new issue** with:
|
4. **Open new issue** with:
|
||||||
- Error messages from logs
|
- Error messages from logs
|
||||||
- Steps to reproduce
|
- Steps to reproduce
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Using the API
|
# Using the API
|
||||||
|
|
||||||
Common workflows and best practices for AI-Trader API.
|
Common workflows and best practices for AI-Trader-Server API.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user