mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-01 17:17:24 -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 @@
|
||||
# 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 asyncio
|
||||
|
||||
class AsyncAITraderClient:
|
||||
class AsyncAITraderServerClient:
|
||||
def __init__(self, base_url="http://localhost:8080"):
|
||||
self.base_url = base_url
|
||||
|
||||
@@ -48,7 +48,7 @@ class AsyncAITraderClient:
|
||||
|
||||
# Usage
|
||||
async def main():
|
||||
client = AsyncAITraderClient()
|
||||
client = AsyncAITraderServerClient()
|
||||
job = await client.trigger_simulation("2025-01-16", models=["gpt-4"])
|
||||
result = await client.wait_for_completion(job["job_id"])
|
||||
print(f"Simulation completed: {result['status']}")
|
||||
@@ -104,7 +104,7 @@ echo "Results saved to results_$DATE.json"
|
||||
|
||||
Add to crontab:
|
||||
```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):
|
||||
response = requests.post(
|
||||
"http://ai-trader:8080/simulate/trigger",
|
||||
"http://ai-trader-server:8080/simulate/trigger",
|
||||
json={"start_date": "{{ ds }}", "models": ["gpt-4"]}
|
||||
)
|
||||
response.raise_for_status()
|
||||
@@ -128,19 +128,19 @@ def trigger_simulation(**context):
|
||||
|
||||
def wait_for_completion(**context):
|
||||
job_id = context["task_instance"].xcom_pull(task_ids="trigger")
|
||||
|
||||
|
||||
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()
|
||||
|
||||
|
||||
if status["status"] in ["completed", "partial", "failed"]:
|
||||
return status
|
||||
|
||||
|
||||
time.sleep(30)
|
||||
|
||||
def fetch_results(**context):
|
||||
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()
|
||||
|
||||
default_args = {
|
||||
@@ -152,7 +152,7 @@ default_args = {
|
||||
}
|
||||
|
||||
dag = DAG(
|
||||
"ai_trader_simulation",
|
||||
"ai_trader_server_simulation",
|
||||
default_args=default_args,
|
||||
schedule_interval="0 6 * * *", # Daily at 6 AM
|
||||
catchup=False
|
||||
@@ -183,7 +183,7 @@ trigger_task >> wait_task >> fetch_task
|
||||
|
||||
## 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`
|
||||
2. **Poll:** GET `/simulate/status/{job_id}` every 10-30 seconds
|
||||
|
||||
Reference in New Issue
Block a user