> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tide.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Leverage (Aster)

Configure leverage for trading on Aster exchange. Leverage allows you to control larger positions with less capital.

## Features

* **Flexible leverage**: Set leverage from 1x to 125x
* **Symbol-specific**: Configure different leverage for each trading pair
* **Risk management**: Higher leverage increases both potential profits and losses

## Aster - Set Leverage

Configure leverage for a specific trading pair on Aster exchange.

### Endpoint

`POST /api/aster/perp/:walletId/leverage`

### Path Parameters

| Parameter  | Type   | Required | Description      |
| ---------- | ------ | -------- | ---------------- |
| `walletId` | string | Yes      | Wallet ID (UUID) |

### Request Body

```json theme={null}
{
  "symbol": "PERPUSDT",
  "leverage": 25
}
```

### Request Parameters

| Field      | Type   | Required | Description                                |
| ---------- | ------ | -------- | ------------------------------------------ |
| `symbol`   | string | Yes      | Trading pair (e.g., "BTCUSDT", "PERPUSDT") |
| `leverage` | number | Yes      | Leverage multiplier (1-125)                |

### Example Request

```bash theme={null}
curl -X POST https://api.tide.ag/api/aster/perp/ee337309-3e77-4278-b21a-4681468168ba/leverage \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "PERPUSDT",
    "leverage": 25
  }'
```

### Success Response

```json theme={null}
{
  "success": true,
  "data": {
    "symbol": "PERPUSDT",
    "leverage": 25,
    "maxNotionalValue": "25000"
  }
}
```

### Response Fields

| Field              | Type   | Description                                             |
| ------------------ | ------ | ------------------------------------------------------- |
| `symbol`           | string | Trading pair                                            |
| `leverage`         | number | Configured leverage multiplier                          |
| `maxNotionalValue` | string | Maximum notional value for positions with this leverage |

## Use Cases

* Set leverage before opening a position
* Adjust risk exposure for different trading strategies
* Configure different leverage levels for various trading pairs
* Implement dynamic leverage based on market conditions

## Important Notes

<Warning>
  **High Leverage Risk**: Higher leverage amplifies both gains and losses. A 125x leverage position can be liquidated with less than 1% adverse price movement.
</Warning>

<Note>
  Leverage must be set before placing orders. The leverage setting applies to all future orders for the specified symbol until changed.
</Note>

<Tip>
  Start with lower leverage (5-10x) when learning to trade perpetual futures. Increase leverage gradually as you gain experience.
</Tip>

## Avantis Leverage

Avantis leverage is configured per-trade at execution time (not via a separate API call). Leverage is passed directly in the `openPosition` request. Limits vary by order type and pair:

| Order Type                   | Pairs              | Min | Max                |
| ---------------------------- | ------------------ | --- | ------------------ |
| MARKET / LIMIT / STOP\_LIMIT | All pairs          | 1x  | 50x (ETH/BTC: 75x) |
| MARKET\_ZERO\_FEE            | ETH, BTC, SOL only | 75x | 250x               |

<Note>
  Avantis does not have a separate set-leverage endpoint. Leverage is specified in each trade request and applies to that individual position.
</Note>

***

## Leverage Guidelines

| Leverage | Risk Level | Use Case                                      |
| -------- | ---------- | --------------------------------------------- |
| 1-5x     | Low        | Conservative trading, learning                |
| 5-20x    | Medium     | Standard trading strategies                   |
| 20-50x   | High       | Experienced traders, short-term trades        |
| 50-125x  | Very High  | Expert traders only, scalping                 |
| 75-250x  | Extreme    | Avantis zero-fee positions (ETH/BTC/SOL only) |

## Error Responses

### 400 Bad Request - Invalid Leverage

```json theme={null}
{
  "success": false,
  "error": "Leverage must be between 1 and 125",
  "timestamp": 1698840000000
}
```

### 400 Bad Request - Invalid Symbol

```json theme={null}
{
  "success": false,
  "error": "Invalid trading symbol",
  "timestamp": 1698840000000
}
```

### 401 Unauthorized - Missing Wallet ID

```json theme={null}
{
  "success": false,
  "error": "Invalid wallet ID",
  "timestamp": 1698840000000
}
```
