Implementation:HKUDS AI Trader A Stock Agent Config
| Knowledge Sources | |
|---|---|
| Domains | Configuration, A_Shares, Agent_Setup |
| Last Updated | 2026-02-09 14:00 GMT |
Overview
JSON configuration files that define agent parameters, model selections, date ranges, and logging paths for Chinese A-share and generic daily/hourly trading experiments.
Description
Four user-facing configuration files provide the parameterization for running AI trading agents across different market types and time granularities. Each file specifies the agent class to use (BaseAgentAStock, BaseAgentAStock_Hour, BaseAgent, or BaseAgent_Hour), a date range for backtesting, a list of LLM models with enable/disable flags, agent hyperparameters (max steps, retries, initial cash), and a log output path. These complement the existing default configs (default_config.json, default_astock_config.json, default_crypto_config.json) which are already documented.
Usage
Pass these config file paths to main.py via the --config CLI argument. The load_config() function reads the JSON and uses its values to configure the agent run. Users edit these files to select which models to run, adjust date ranges, and set initial capital.
Code Reference
Source Location
- Repository: HKUDS_AI_Trader
- Directory: configs/
- Files:
- configs/astock_config.json (62 lines)
- configs/astock_hour_config.json (64 lines)
- configs/default_day_config.json (51 lines)
- configs/default_hour_config.json (51 lines)
Schema
{
"agent_type": "BaseAgentAStock",
"market": "cn",
"date_range": {
"init_date": "2025-10-01",
"end_date": "2025-10-29"
},
"models": [
{
"name": "claude-3.7-sonnet",
"basemodel": "claude-3-7-sonnet-20250219",
"signature": "claude-3.7-sonnet",
"enabled": false
}
],
"agent_config": {
"max_steps": 30,
"max_retries": 3,
"base_delay": 1.0,
"initial_cash": 100000.0
},
"log_config": {
"log_path": "./data/agent_data_astock"
}
}
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | Static config files; no runtime inputs |
Outputs
| Field | Type | Description |
|---|---|---|
| agent_type | string | Agent class name to instantiate |
| market | string | Market identifier ("cn" for A-shares; absent for US) |
| date_range | object | init_date and end_date for backtesting window |
| models | array | List of LLM model configs with enabled flags |
| agent_config | object | max_steps, max_retries, base_delay, initial_cash |
| log_config | object | log_path for output directory |
Usage Examples
# Run A-share daily backtesting with astock_config.json
python main.py --config configs/astock_config.json
# Run US stock hourly backtesting
python main.py --config configs/default_hour_config.json