mirror of
https://github.com/HKUDS/AI-Trader
synced 2026-04-21 13:37:41 +00:00
update readme, solve .env.example
This commit is contained in:
parent
303feda5bb
commit
4965d29819
6 changed files with 115 additions and 11 deletions
|
|
@ -7,6 +7,7 @@ MATH_HTTP_PORT=8000
|
|||
SEARCH_HTTP_PORT=8001
|
||||
TRADE_HTTP_PORT=8002
|
||||
GETPRICE_HTTP_PORT=8003
|
||||
CRYPTO_HTTP_PORT=8005
|
||||
|
||||
AGENT_MAX_STEP=30
|
||||
|
||||
|
|
|
|||
31
README.md
31
README.md
|
|
@ -347,7 +347,7 @@ OPENAI_API_BASE=https://your-openai-proxy.com/v1
|
|||
OPENAI_API_KEY=your_openai_key
|
||||
|
||||
# 📊 Data Source Configuration
|
||||
ALPHAADVANTAGE_API_KEY=your_alpha_vantage_key # For NASDAQ 100 data
|
||||
ALPHAADVANTAGE_API_KEY=your_alpha_vantage_key # For NASDAQ 100 and cryptocurrency data
|
||||
JINA_API_KEY=your_jina_api_key
|
||||
TUSHARE_TOKEN=your_tushare_token # For A-share data
|
||||
|
||||
|
|
@ -359,6 +359,8 @@ MATH_HTTP_PORT=8000
|
|||
SEARCH_HTTP_PORT=8001
|
||||
TRADE_HTTP_PORT=8002
|
||||
GETPRICE_HTTP_PORT=8003
|
||||
CRYPTO_HTTP_PORT=8005
|
||||
|
||||
# 🧠 AI Agent Configuration
|
||||
AGENT_MAX_STEP=30 # Maximum reasoning steps
|
||||
```
|
||||
|
|
@ -455,6 +457,21 @@ python merge_jsonl_hourly.py
|
|||
# 📊 Hourly data will be saved to: data/A_stock/merged_hourly.jsonl
|
||||
```
|
||||
|
||||
#### ₿ Cryptocurrency Market Data (BITWISE10)
|
||||
|
||||
```bash
|
||||
# 📈 Get cryptocurrency market data (BITWISE10)
|
||||
cd data/crypto
|
||||
|
||||
# 📊 Get daily price data for major cryptocurrencies
|
||||
python get_daily_price_crypto.py
|
||||
|
||||
# 🔄 Merge data into unified format
|
||||
python merge_crypto_jsonl.py
|
||||
|
||||
# 📊 Crypto data will be saved to: data/crypto/crypto_merged.jsonl
|
||||
```
|
||||
|
||||
|
||||
### 🛠️ Step 2: Start MCP Services
|
||||
|
||||
|
|
@ -578,17 +595,21 @@ python main.py configs/default_crypto_config.json
|
|||
},
|
||||
"models": [
|
||||
{
|
||||
"name": "deepseek-v3.2",
|
||||
"enabled": true,
|
||||
"basemodel": "deepseek-chat",
|
||||
"signature": "deepseek-v3.2"
|
||||
"name": "claude-3.7-sonnet",
|
||||
"basemodel": "anthropic/claude-3.7-sonnet",
|
||||
"signature": "claude-3.7-sonnet",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"agent_config": {
|
||||
"initial_cash": 50000.0 // Initial capital: 50,000 USDT
|
||||
},
|
||||
"log_config": {
|
||||
"log_path": "./data/agent_data_crypto" // crypto daily data path
|
||||
}
|
||||
}
|
||||
```
|
||||
> 💡 **Tip**: `BaseAgentCrypto` will use the price at UTC 00:00 as the buy/sell price. The market should be set to `"crypto"`.
|
||||
|
||||
### 📈 Start Web Interface
|
||||
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ OPENAI_API_BASE=https://your-openai-proxy.com/v1
|
|||
OPENAI_API_KEY=your_openai_key
|
||||
|
||||
# 📊 数据源配置
|
||||
ALPHAADVANTAGE_API_KEY=your_alpha_vantage_key # 用于纳斯达克100数据
|
||||
ALPHAADVANTAGE_API_KEY=your_alpha_vantage_key # 用于纳斯达克100和加密货币数据
|
||||
JINA_API_KEY=your_jina_api_key
|
||||
TUSHARE_TOKEN=your_tushare_token # 用于A股数据
|
||||
|
||||
|
|
@ -367,6 +367,8 @@ MATH_HTTP_PORT=8000
|
|||
SEARCH_HTTP_PORT=8001
|
||||
TRADE_HTTP_PORT=8002
|
||||
GETPRICE_HTTP_PORT=8003
|
||||
CRYPTO_HTTP_PORT=8005
|
||||
|
||||
# 🧠 AI代理配置
|
||||
AGENT_MAX_STEP=30 # 最大推理步数
|
||||
```
|
||||
|
|
@ -603,10 +605,15 @@ python main.py configs/default_crypto_config.json
|
|||
],
|
||||
"agent_config": {
|
||||
"initial_cash": 50000.0 // 初始资金:50,000 USDT
|
||||
},
|
||||
"log_config": {
|
||||
"log_path": "./data/agent_data_crypto" // 加密货币数据路径
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> 💡 **提示**: `BaseAgentCrypto` 将使用UTC 00:00的价格作为买入/卖出价格,市场应设置为 `"crypto"`。
|
||||
|
||||
> 💡 **提示**: 使用 `BaseAgentCrypto` 时,`market` 参数会被自动设置为 `"crypto"`,无需手动指定。
|
||||
|
||||
> 💡 **提示**: 使用 `BaseAgentAStock` 时,`market` 参数会被自动设置为 `"cn"`,无需手动指定。
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ This directory contains multiple configuration files for different trading scena
|
|||
| `default_config.json` | US (NASDAQ 100) | Daily | Default US stock trading configuration |
|
||||
| `astock_config.json` | CN (SSE 50) | Daily | A-share daily trading configuration |
|
||||
| `astock_hour_config.json` | CN (SSE 50) | Hourly | A-share hourly trading configuration (10:30/11:30/14:00/15:00) |
|
||||
| `default_crypto_config.json` | Crypto (BITWISE10) | Daily | Cryptocurrency trading configuration with BaseAgentCrypto |
|
||||
|
||||
### `default_config.json`
|
||||
|
||||
|
|
@ -172,6 +173,35 @@ Certain configuration values can be overridden using environment variables:
|
|||
|
||||
> 💡 **Tip**: A-share hourly trading time points: 10:30, 11:30, 14:00, 15:00 (4 time points per day)
|
||||
|
||||
### Cryptocurrency Daily Configuration (BaseAgentCrypto)
|
||||
```json
|
||||
{
|
||||
"agent_type": "BaseAgentCrypto",
|
||||
"market": "crypto",
|
||||
"date_range": {
|
||||
"init_date": "2025-10-20",
|
||||
"end_date": "2025-10-31"
|
||||
},
|
||||
"models": [
|
||||
{
|
||||
"name": "claude-3.7-sonnet",
|
||||
"basemodel": "anthropic/claude-3.7-sonnet",
|
||||
"signature": "claude-3.7-sonnet",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"agent_config": {
|
||||
"max_steps": 30,
|
||||
"initial_cash": 50000.0
|
||||
},
|
||||
"log_config": {
|
||||
"log_path": "./data/agent_data_crypto"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> 💡 **Tip**: BaseAgentCrypto uses UTC 00:00 price for buy/sell operations and supports 24/7 cryptocurrency trading
|
||||
|
||||
### Multi-Model Configuration
|
||||
```json
|
||||
{
|
||||
|
|
@ -241,6 +271,13 @@ Certain configuration values can be overridden using environment variables:
|
|||
- **Trading Rules**: T+1 settlement, 100-share lot size, CNY pricing
|
||||
- **Data Source**: merged_hourly.jsonl
|
||||
|
||||
### BaseAgentCrypto (Crypto Daily)
|
||||
- **Market Support**: Cryptocurrencies only
|
||||
- **Trading Frequency**: Daily
|
||||
- **Use Case**: Specialized cryptocurrency daily trading with built-in crypto market rules
|
||||
- **Asset Pool**: BITWISE10 index by default (BTC, ETH, XRP, SOL, ADA, SUI, LINK, AVAX, LTC, DOT)
|
||||
- **Trading Rules**: 24/7 trading, USDT denominated, no lot size restrictions, uses UTC 00:00 price for buy/sell operations
|
||||
|
||||
## Notes
|
||||
|
||||
- Configuration files must be valid JSON format
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
| `default_config.json` | 美股(纳斯达克100) | 日线 | 默认美股交易配置 |
|
||||
| `astock_config.json` | A股(上证50) | 日线 | A股日线交易配置 |
|
||||
| `astock_hour_config.json` | A股(上证50) | 小时级 | A股小时级交易配置(10:30/11:30/14:00/15:00) |
|
||||
| `default_crypto_config.json` | 加密货币(BITWISE10) | 日线 | 加密货币交易配置,使用BaseAgentCrypto |
|
||||
|
||||
### `default_config.json`
|
||||
|
||||
|
|
@ -172,6 +173,35 @@ python main.py configs/test_real_hour_config.json
|
|||
|
||||
> 💡 **提示**: A股小时级交易时间点为:10:30、11:30、14:00、15:00(每天4个时间点)
|
||||
|
||||
### 加密货币日线配置示例(BaseAgentCrypto)
|
||||
```json
|
||||
{
|
||||
"agent_type": "BaseAgentCrypto",
|
||||
"market": "crypto",
|
||||
"date_range": {
|
||||
"init_date": "2025-10-20",
|
||||
"end_date": "2025-10-31"
|
||||
},
|
||||
"models": [
|
||||
{
|
||||
"name": "claude-3.7-sonnet",
|
||||
"basemodel": "anthropic/claude-3.7-sonnet",
|
||||
"signature": "claude-3.7-sonnet",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"agent_config": {
|
||||
"max_steps": 30,
|
||||
"initial_cash": 50000.0
|
||||
},
|
||||
"log_config": {
|
||||
"log_path": "./data/agent_data_crypto"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> 💡 **提示**: BaseAgentCrypto使用UTC 00:00价格进行买入/卖出操作,支持24/7加密货币交易
|
||||
|
||||
### 多模型配置
|
||||
```json
|
||||
{
|
||||
|
|
@ -241,6 +271,13 @@ python main.py configs/test_real_hour_config.json
|
|||
- **交易规则**:T+1结算,100股为一手,人民币计价
|
||||
- **数据源**:merged_hourly.jsonl
|
||||
|
||||
### BaseAgentCrypto(加密货币日线专用代理)
|
||||
- **市场支持**:仅加密货币市场
|
||||
- **交易频率**:日线
|
||||
- **使用场景**:专为加密货币日线交易优化,内置数字货币市场规则
|
||||
- **资产池**:默认BITWISE10指数(BTC、ETH、XRP、SOL、ADA、SUI、LINK、AVAX、LTC、DOT)
|
||||
- **交易规则**:24/7交易,USDT计价,无手数限制,使用UTC 00:00价格进行买卖操作
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 配置文件必须是有效的JSON格式
|
||||
|
|
@ -249,7 +286,7 @@ python main.py configs/test_real_hour_config.json
|
|||
- 配置错误会导致系统退出并显示相应的错误消息
|
||||
- 配置系统通过`AGENT_REGISTRY`映射支持动态代理类加载
|
||||
- 使用`BaseAgentAStock`时,`market`参数会自动设置为`"cn"`
|
||||
- 初始资金建议:美股 $10,000,A股 ¥100,000
|
||||
- 初始资金建议:美股 $10,000,A股 ¥100,000,加密货币 50,000 USDT
|
||||
|
||||
## 配置参数详解
|
||||
|
||||
|
|
@ -259,6 +296,7 @@ python main.py configs/test_real_hour_config.json
|
|||
- `BaseAgent_Hour`: 美股小时级交易代理
|
||||
- `BaseAgentAStock`: A股日线专用交易代理,内置A股交易规则
|
||||
- `BaseAgentAStock_Hour`: A股小时级专用交易代理,支持盘中4个时间点交易
|
||||
- `BaseAgentCrypto`: 加密货币日线专用交易代理,内置数字货币交易规则
|
||||
|
||||
### 模型配置 (models)
|
||||
每个模型需要包含以下字段:
|
||||
|
|
|
|||
|
|
@ -10,25 +10,25 @@
|
|||
"name": "claude-3.7-sonnet",
|
||||
"basemodel": "anthropic/claude-3.7-sonnet",
|
||||
"signature": "claude-3.7-sonnet",
|
||||
"enabled": true
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"name": "deepseek-chat-v3.1",
|
||||
"basemodel": "deepseek/deepseek-chat-v3.1",
|
||||
"signature": "deepseek-chat-v3.1",
|
||||
"enabled": true
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"name": "qwen3-max",
|
||||
"basemodel": "qwen/qwen3-max",
|
||||
"signature": "qwen3-max",
|
||||
"enabled": true
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"name": "gemini-2.5-flash",
|
||||
"basemodel": "google/gemini-2.5-flash",
|
||||
"signature": "gemini-2.5-flash",
|
||||
"enabled": true
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"name": "gpt-5",
|
||||
|
|
|
|||
Loading…
Reference in a new issue