mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-02 01:27:24 -04:00
Compare commits
5 Commits
v0.3.0-alp
...
v0.3.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 9539d63103 | |||
| 47b9df6b82 | |||
| d587a5f213 | |||
| c929080960 | |||
| 849e7bffa2 |
11
.env.example
11
.env.example
@@ -13,17 +13,6 @@ OPENAI_API_KEY=your_openai_key_here # https://platform.openai.com/api-keys
|
||||
ALPHAADVANTAGE_API_KEY=your_alphavantage_key_here # https://www.alphavantage.co/support/#api-key
|
||||
JINA_API_KEY=your_jina_key_here # https://jina.ai/
|
||||
|
||||
# System Configuration (Docker default paths)
|
||||
RUNTIME_ENV_PATH=/app/data/runtime_env.json
|
||||
|
||||
# MCP Service Host Ports (exposed on host machine)
|
||||
# Container always uses 8000-8003 internally
|
||||
# Change these if you need different ports on your host
|
||||
MATH_HTTP_PORT=8000
|
||||
SEARCH_HTTP_PORT=8001
|
||||
TRADE_HTTP_PORT=8002
|
||||
GETPRICE_HTTP_PORT=8003
|
||||
|
||||
# API Server Port (exposed on host machine for REST API)
|
||||
# Container ALWAYS uses port 8080 internally (hardcoded in entrypoint.sh)
|
||||
# This variable ONLY controls the host port mapping (host:API_PORT -> container:8080)
|
||||
|
||||
3
.github/workflows/docker-release.yml
vendored
3
.github/workflows/docker-release.yml
vendored
@@ -67,8 +67,7 @@ jobs:
|
||||
|
||||
# Only add 'latest' tag for stable releases
|
||||
if [[ "$IS_PRERELEASE" == "false" ]]; then
|
||||
TAGS="$TAGS
|
||||
ghcr.io/$REPO_OWNER_LOWER/ai-trader:latest"
|
||||
TAGS="${TAGS}"$'\n'"ghcr.io/$REPO_OWNER_LOWER/ai-trader:latest"
|
||||
echo "Tagging as both $VERSION and latest"
|
||||
else
|
||||
echo "Pre-release detected - tagging as $VERSION only (NOT latest)"
|
||||
|
||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -56,11 +56,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- **Architecture** - Transformed from batch-only to API-first service with database persistence
|
||||
- **Data Storage** - Migrated from JSONL files to SQLite relational database
|
||||
- **Deployment** - Simplified to single API-only Docker service
|
||||
- **Configuration** - Added configurable API_PORT environment variable (default: 8080, customizable for port conflicts)
|
||||
- **Configuration** - Simplified environment variable configuration
|
||||
- Added configurable API_PORT for host port mapping (default: 8080, customizable for port conflicts)
|
||||
- Removed `RUNTIME_ENV_PATH` (API dynamically manages runtime configs via RuntimeConfigManager)
|
||||
- Removed MCP service port configuration (MATH_HTTP_PORT, SEARCH_HTTP_PORT, TRADE_HTTP_PORT, GETPRICE_HTTP_PORT)
|
||||
- MCP services use fixed internal ports (8000-8003) and are no longer exposed to host
|
||||
- Container always uses port 8080 internally for API (hardcoded in entrypoint.sh)
|
||||
- Only API port (8080) and web dashboard (8888) are exposed to host
|
||||
- Reduces configuration complexity and attack surface
|
||||
- **Requirements** - Added fastapi>=0.120.0, uvicorn[standard]>=0.27.0, pydantic>=2.0.0
|
||||
- **Docker Compose** - Single service (ai-trader) instead of dual-mode
|
||||
- **Dockerfile** - Added system dependencies (curl, procps) and port 8080 exposure
|
||||
- **.env.example** - Enhanced API server configuration with port conflict documentation
|
||||
- **.env.example** - Simplified configuration with only essential variables
|
||||
- **Entrypoint** - Unified entrypoint.sh with proper signal handling (exec uvicorn)
|
||||
|
||||
### Technical Implementation
|
||||
|
||||
21
CLAUDE.md
21
CLAUDE.md
@@ -20,8 +20,6 @@ cp .env.example .env
|
||||
# Edit .env and set:
|
||||
# - OPENAI_API_BASE, OPENAI_API_KEY
|
||||
# - ALPHAADVANTAGE_API_KEY, JINA_API_KEY
|
||||
# - RUNTIME_ENV_PATH (recommended: absolute path to runtime_env.json)
|
||||
# - MCP service ports (default: 8000-8003)
|
||||
# - AGENT_MAX_STEP (default: 30)
|
||||
```
|
||||
|
||||
@@ -41,11 +39,8 @@ cd agent_tools
|
||||
python start_mcp_services.py
|
||||
cd ..
|
||||
|
||||
# Services run on ports defined in .env:
|
||||
# - MATH_HTTP_PORT (default: 8000)
|
||||
# - SEARCH_HTTP_PORT (default: 8001)
|
||||
# - TRADE_HTTP_PORT (default: 8002)
|
||||
# - GETPRICE_HTTP_PORT (default: 8003)
|
||||
# MCP services use fixed internal ports (8000-8003)
|
||||
# These are not exposed to the host and should not be changed
|
||||
```
|
||||
|
||||
### Docker Deployment
|
||||
@@ -163,8 +158,10 @@ bash main.sh
|
||||
3. JSON config file
|
||||
4. Default values (lowest)
|
||||
|
||||
**Runtime configuration** (`runtime_env.json` at `RUNTIME_ENV_PATH`):
|
||||
- Dynamic state: `TODAY_DATE`, `SIGNATURE`, `IF_TRADE`
|
||||
**Runtime configuration** (API mode only):
|
||||
- Dynamically created per model-day execution via `RuntimeConfigManager`
|
||||
- Isolated config files prevent concurrent execution conflicts
|
||||
- Contains: `TODAY_DATE`, `SIGNATURE`, `IF_TRADE`, `JOB_ID`
|
||||
- Written by `write_config_value()`, read by `get_config_value()`
|
||||
|
||||
### Agent System
|
||||
@@ -319,9 +316,9 @@ When modifying agent behavior or adding tools:
|
||||
- Check Alpha Vantage API key is valid
|
||||
|
||||
**Runtime Config Issues:**
|
||||
- Set `RUNTIME_ENV_PATH` to absolute path in `.env`
|
||||
- Ensure directory is writable
|
||||
- File gets created automatically on first run
|
||||
- Runtime configs are automatically managed by the API
|
||||
- Configs are created per model-day execution in `data/` directory
|
||||
- Ensure `data/` directory is writable
|
||||
|
||||
**Agent Doesn't Stop Trading:**
|
||||
- Agent must output `<FINISH_SIGNAL>` within `max_steps`
|
||||
|
||||
@@ -291,14 +291,6 @@ OPENAI_API_KEY=your_openai_key
|
||||
ALPHAADVANTAGE_API_KEY=your_alpha_vantage_key
|
||||
JINA_API_KEY=your_jina_api_key
|
||||
|
||||
# ⚙️ System Configuration
|
||||
RUNTIME_ENV_PATH=./runtime_env.json # Recommended to use absolute path
|
||||
|
||||
# 🌐 Service Port Configuration
|
||||
MATH_HTTP_PORT=8000
|
||||
SEARCH_HTTP_PORT=8001
|
||||
TRADE_HTTP_PORT=8002
|
||||
GETPRICE_HTTP_PORT=8003
|
||||
# 🧠 AI Agent Configuration
|
||||
AGENT_MAX_STEP=30 # Maximum reasoning steps
|
||||
```
|
||||
|
||||
@@ -18,27 +18,10 @@ services:
|
||||
- ALPHAADVANTAGE_API_KEY=${ALPHAADVANTAGE_API_KEY}
|
||||
- JINA_API_KEY=${JINA_API_KEY}
|
||||
|
||||
# System Configuration
|
||||
- RUNTIME_ENV_PATH=/app/data/runtime_env.json
|
||||
|
||||
# MCP Service Ports (fixed internally)
|
||||
- MATH_HTTP_PORT=8000
|
||||
- SEARCH_HTTP_PORT=8001
|
||||
- TRADE_HTTP_PORT=8002
|
||||
- GETPRICE_HTTP_PORT=8003
|
||||
|
||||
# API Configuration
|
||||
- API_PORT=${API_PORT:-8080}
|
||||
|
||||
# Agent Configuration
|
||||
- AGENT_MAX_STEP=${AGENT_MAX_STEP:-30}
|
||||
ports:
|
||||
# MCP service ports (internal)
|
||||
- "${MATH_HTTP_PORT:-8000}:8000"
|
||||
- "${SEARCH_HTTP_PORT:-8001}:8001"
|
||||
- "${TRADE_HTTP_PORT:-8002}:8002"
|
||||
- "${GETPRICE_HTTP_PORT:-8003}:8003"
|
||||
# API server port (primary interface)
|
||||
# API server port (primary interface for external access)
|
||||
- "${API_PORT:-8080}:8080"
|
||||
# Web dashboard
|
||||
- "${WEB_HTTP_PORT:-8888}:8888"
|
||||
|
||||
Reference in New Issue
Block a user