mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-08 11:47:24 -04:00
Compare commits
7 Commits
v0.2.0-alp
...
v0.2.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 12ecb1e6b6 | |||
| 203b60b252 | |||
| d70362b9d4 | |||
| 5ec7977b47 | |||
| 8142f38ab9 | |||
| 595a659fe7 | |||
| a4bc4fd0de |
@@ -5,12 +5,13 @@
|
|||||||
# Docker Compose automatically reads .env from project root
|
# Docker Compose automatically reads .env from project root
|
||||||
|
|
||||||
# AI Model API Configuration
|
# AI Model API Configuration
|
||||||
OPENAI_API_BASE=https://your-openai-proxy.com/v1
|
# OPENAI_API_BASE: Leave empty to use default OpenAI endpoint, or set to custom proxy URL
|
||||||
OPENAI_API_KEY=your_openai_key_here
|
OPENAI_API_BASE=
|
||||||
|
OPENAI_API_KEY=your_openai_key_here # https://platform.openai.com/api-keys
|
||||||
|
|
||||||
# Data Source Configuration
|
# Data Source Configuration
|
||||||
ALPHAADVANTAGE_API_KEY=your_alphavantage_key_here
|
ALPHAADVANTAGE_API_KEY=your_alphavantage_key_here # https://www.alphavantage.co/support/#api-key
|
||||||
JINA_API_KEY=your_jina_key_here
|
JINA_API_KEY=your_jina_key_here # https://jina.ai/
|
||||||
|
|
||||||
# System Configuration (Docker default paths)
|
# System Configuration (Docker default paths)
|
||||||
RUNTIME_ENV_PATH=/app/data/runtime_env.json
|
RUNTIME_ENV_PATH=/app/data/runtime_env.json
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -218,7 +218,7 @@ AI-Trader Bench/
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Clone project
|
# 1. Clone project
|
||||||
git clone https://github.com/HKUDS/AI-Trader.git
|
git clone https://github.com/Xe138/AI-Trader.git
|
||||||
cd AI-Trader
|
cd AI-Trader
|
||||||
|
|
||||||
# 2. Install dependencies
|
# 2. Install dependencies
|
||||||
@@ -331,7 +331,7 @@ The easiest way to run AI-Trader is with Docker Compose:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Clone and setup
|
# 1. Clone and setup
|
||||||
git clone https://github.com/HKUDS/AI-Trader.git
|
git clone https://github.com/Xe138/AI-Trader.git
|
||||||
cd AI-Trader
|
cd AI-Trader
|
||||||
|
|
||||||
# 2. Configure environment
|
# 2. Configure environment
|
||||||
@@ -590,8 +590,8 @@ We welcome contributions of all kinds! Especially AI trading strategies and agen
|
|||||||
|
|
||||||
## 📞 Support & Community
|
## 📞 Support & Community
|
||||||
|
|
||||||
- **💬 Discussions**: [GitHub Discussions](https://github.com/HKUDS/AI-Trader/discussions)
|
- **💬 Discussions**: [GitHub Discussions](https://github.com/Xe138/AI-Trader/discussions)
|
||||||
- **🐛 Issues**: [GitHub Issues](https://github.com/HKUDS/AI-Trader/issues)
|
- **🐛 Issues**: [GitHub Issues](https://github.com/Xe138/AI-Trader/issues)
|
||||||
|
|
||||||
## 📄 License
|
## 📄 License
|
||||||
|
|
||||||
@@ -615,8 +615,8 @@ The materials provided by the AI-Trader project are for research purposes only a
|
|||||||
|
|
||||||
**🌟 If this project helps you, please give us a Star!**
|
**🌟 If this project helps you, please give us a Star!**
|
||||||
|
|
||||||
[](https://github.com/HKUDS/AI-Trader)
|
[](https://github.com/Xe138/AI-Trader)
|
||||||
[](https://github.com/HKUDS/AI-Trader)
|
[](https://github.com/Xe138/AI-Trader)
|
||||||
|
|
||||||
**🤖 Experience AI's full potential in financial markets through complete autonomous decision-making!**
|
**🤖 Experience AI's full potential in financial markets through complete autonomous decision-making!**
|
||||||
**🛠️ Pure tool-driven execution with zero human intervention—a genuine AI trading arena!** 🚀
|
**🛠️ Pure tool-driven execution with zero human intervention—a genuine AI trading arena!** 🚀
|
||||||
|
|||||||
@@ -27,32 +27,33 @@ class MCPServiceManager:
|
|||||||
'price': int(os.getenv('GETPRICE_HTTP_PORT', '8003'))
|
'price': int(os.getenv('GETPRICE_HTTP_PORT', '8003'))
|
||||||
}
|
}
|
||||||
|
|
||||||
# Service configurations
|
# Service configurations (paths relative to /app)
|
||||||
|
self.agent_tools_dir = Path(__file__).parent.resolve()
|
||||||
self.service_configs = {
|
self.service_configs = {
|
||||||
'math': {
|
'math': {
|
||||||
'script': 'tool_math.py',
|
'script': self.agent_tools_dir / 'tool_math.py',
|
||||||
'name': 'Math',
|
'name': 'Math',
|
||||||
'port': self.ports['math']
|
'port': self.ports['math']
|
||||||
},
|
},
|
||||||
'search': {
|
'search': {
|
||||||
'script': 'tool_jina_search.py',
|
'script': self.agent_tools_dir / 'tool_jina_search.py',
|
||||||
'name': 'Search',
|
'name': 'Search',
|
||||||
'port': self.ports['search']
|
'port': self.ports['search']
|
||||||
},
|
},
|
||||||
'trade': {
|
'trade': {
|
||||||
'script': 'tool_trade.py',
|
'script': self.agent_tools_dir / 'tool_trade.py',
|
||||||
'name': 'TradeTools',
|
'name': 'TradeTools',
|
||||||
'port': self.ports['trade']
|
'port': self.ports['trade']
|
||||||
},
|
},
|
||||||
'price': {
|
'price': {
|
||||||
'script': 'tool_get_price_local.py',
|
'script': self.agent_tools_dir / 'tool_get_price_local.py',
|
||||||
'name': 'LocalPrices',
|
'name': 'LocalPrices',
|
||||||
'port': self.ports['price']
|
'port': self.ports['price']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create logs directory
|
# Create logs directory
|
||||||
self.log_dir = Path('../logs')
|
self.log_dir = Path('logs')
|
||||||
self.log_dir.mkdir(exist_ok=True)
|
self.log_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
# Set signal handlers
|
# Set signal handlers
|
||||||
@@ -71,7 +72,7 @@ class MCPServiceManager:
|
|||||||
service_name = config['name']
|
service_name = config['name']
|
||||||
port = config['port']
|
port = config['port']
|
||||||
|
|
||||||
if not Path(script_path).exists():
|
if not script_path.exists():
|
||||||
print(f"❌ Script file not found: {script_path}")
|
print(f"❌ Script file not found: {script_path}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -80,10 +81,10 @@ class MCPServiceManager:
|
|||||||
log_file = self.log_dir / f"{service_id}.log"
|
log_file = self.log_dir / f"{service_id}.log"
|
||||||
with open(log_file, 'w') as f:
|
with open(log_file, 'w') as f:
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
[sys.executable, script_path],
|
[sys.executable, str(script_path)],
|
||||||
stdout=f,
|
stdout=f,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
cwd=os.getcwd()
|
cwd=Path.cwd() # Use current working directory (/app)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.services[service_id] = {
|
self.services[service_id] = {
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ def get_daily_price(SYMBOL: str):
|
|||||||
url = f'https://www.alphavantage.co/query?function={FUNCTION}&symbol={SYMBOL}&outputsize={OUTPUTSIZE}&apikey={APIKEY}'
|
url = f'https://www.alphavantage.co/query?function={FUNCTION}&symbol={SYMBOL}&outputsize={OUTPUTSIZE}&apikey={APIKEY}'
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
data = r.json()
|
data = r.json()
|
||||||
print(data)
|
|
||||||
if data.get('Note') is not None or data.get('Information') is not None:
|
if data.get('Note') is not None or data.get('Information') is not None:
|
||||||
print(f"Error")
|
print(f"⚠️ {SYMBOL}: API rate limit or error - {data.get('Note') or data.get('Information')}")
|
||||||
return
|
return
|
||||||
|
print(f"✓ Fetched {SYMBOL}")
|
||||||
with open(f'./daily_prices_{SYMBOL}.json', 'w', encoding='utf-8') as f:
|
with open(f'./daily_prices_{SYMBOL}.json', 'w', encoding='utf-8') as f:
|
||||||
json.dump(data, f, ensure_ascii=False, indent=4)
|
json.dump(data, f, ensure_ascii=False, indent=4)
|
||||||
if SYMBOL == "QQQ":
|
if SYMBOL == "QQQ":
|
||||||
|
|||||||
@@ -47,10 +47,9 @@ cd /app
|
|||||||
|
|
||||||
# Step 2: Start MCP services in background
|
# Step 2: Start MCP services in background
|
||||||
echo "🔧 Starting MCP services..."
|
echo "🔧 Starting MCP services..."
|
||||||
cd /app/agent_tools
|
|
||||||
python start_mcp_services.py &
|
|
||||||
MCP_PID=$!
|
|
||||||
cd /app
|
cd /app
|
||||||
|
python agent_tools/start_mcp_services.py &
|
||||||
|
MCP_PID=$!
|
||||||
|
|
||||||
# Step 3: Wait for services to initialize
|
# Step 3: Wait for services to initialize
|
||||||
echo "⏳ Waiting for MCP services to start..."
|
echo "⏳ Waiting for MCP services to start..."
|
||||||
|
|||||||
Reference in New Issue
Block a user