# AlphaAgentEvo Project

This is a reinforcement learning-based quantitative trading agent project, including backtest API backend service and reinforcement learning training module.

## Project Structure

- `backtest_api/`: Backtest API backend service
- `verl/`: Reinforcement learning training module

## Environment Installation

### 1. Backtest API Environment Installation

#### Install Dependencies
```bash
cd backtest_api
conda create -n backtest python=3.10
conda activate backtest
pip install -r requirements.txt
```

#### Start and Test Backtest Backend API
```bash
conda activate backtest
python start_api.py
```

#### Test in Another Window
```bash
cd backtest_api
conda activate backtest
python test_api_client.py 
```


### 2. Reinforcement Learning Training Environment Installation

#### Create Conda Environment
```bash
conda create -n verl python=3.10
conda activate verl
```

#### Install verl
```bash
# git clone https://github.com/volcengine/verl.git
cd verl
USE_MEGATRON=0 bash scripts/install_vllm_sglang_mcore.sh
pip install --no-deps -e .
```

#### Install TensorBoard
```bash
pip install tensorboard
```

## Deployment Process

### 1. Start Backtest API Service

```bash
cd backtest_api
python start_api.py
```

The service will start on port 8001.

### 2. Test Backtest API

```bash
python test_api_client.py
```

## Run Training

### 1. Start Reinforcement Learning Training

```bash
cd verl
bash examples/sglang_multiturn/search_r1_like/run_qwen2.5-1.7b_instruct_factor_multiturn.sh
```

### 2. Monitor Training Progress

Use TensorBoard to view training logs:

```bash
tensorboard --logdir verl/tensorboard_log/alphaagent-r/qwen3-1.7b-factor_5x_datav5_bs10_rollout4_rewardv3_turn3_lr2e-7/
```