# Strategies

Manage trading strategies.

## Endpoints

| Method | Path                         | Description              |
| ------ | ---------------------------- | ------------------------ |
| GET    | `/v1/strategies`             | List strategies          |
| GET    | `/v1/strategies/:id`         | Get strategy             |
| POST   | `/v1/strategies`             | Create strategy          |
| PATCH  | `/v1/strategies/:id`         | Update strategy          |
| DELETE | `/v1/strategies/:id`         | Delete strategy          |
| POST   | `/v1/strategies/:id/copiers` | Link copiers to strategy |

***

### List Strategies

```
GET /v1/strategies
```

```bash
curl https://rest-api.tokenbot.com/v1/strategies \
  -H "X-API-Key: tb_live_your_key"
```

***

### Get Strategy

```
GET /v1/strategies/:id
```

```bash
curl https://rest-api.tokenbot.com/v1/strategies/str_abc123 \
  -H "X-API-Key: tb_live_your_key"
```

***

### Create Strategy

```
POST /v1/strategies
```

**Request Body:**

```json
{
  "exchange_account_id": "exc_abc123",
  "name": "BTC Momentum",
  "description": "Momentum-based BTC/USDT strategy",
  "is_public": false,
  "risk_level": 3,
  "max_drawdown": 10.0,
  "max_allocation": 50.0,
  "trading_pairs": ["BTC/USDT"]
}
```

```bash
curl -X POST https://rest-api.tokenbot.com/v1/strategies \
  -H "X-API-Key: tb_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"exchange_account_id":"exc_abc123","name":"BTC Momentum","risk_level":3}'
```

***

### Update Strategy

```
PATCH /v1/strategies/:id
```

```bash
curl -X PATCH https://rest-api.tokenbot.com/v1/strategies/str_abc123 \
  -H "X-API-Key: tb_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"name":"Updated Name","risk_level":2}'
```

***

### Delete Strategy

```
DELETE /v1/strategies/:id
```

```bash
curl -X DELETE https://rest-api.tokenbot.com/v1/strategies/str_abc123 \
  -H "X-API-Key: tb_live_your_key"
```

***

### Link Copiers to Strategy

```
POST /v1/strategies/:id/copiers
```

**Request Body:**

```json
{
  "copier_ids": ["cop_abc123", "cop_def456"]
}
```

```bash
curl -X POST https://rest-api.tokenbot.com/v1/strategies/str_abc123/copiers \
  -H "X-API-Key: tb_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"copier_ids":["cop_abc123"]}'
```
