# DCA positions

`POST https://api.cryptohopper.com/v1/hopper/{id}/position/dca`

Part of [Positions](https://www.cryptohopper.com/api-documentation/api-reference/positions.md) in the Cryptohopper API reference.

Places a DCA buy order for each of the given open positions, priced at the current ask and sized by the hopper's DCA size setting. Optionally creates a trailing stop buy instead of a direct order.

OAuth scope: `read`, `manage`, `trade`

dca_mode is merged (default) or individual; individual falls back to merged when the subscription does not include it. market_order 1 places a market order, otherwise a limit order. trailing_buy 1 together with a trailing_buy_percentage above 0 creates a trailing stop buy. The order must fit in the hopper's quote currency balance. Not available for exchange arbitrage, market maker, copy and grid bots.

## Headers

| Name | Type | Required | Description |
|---|---|---|---|
| `access-token` | string | yes | The OAuth access token of the user. |

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Hopper ID. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `position_ids` | array of integer | no |  |
| `market_order` | number | no | Minimum 0. |
| `dca_mode` | string | no | One of: merged, individual. |
| `trailing_buy` | number | no | Minimum 0. |
| `trailing_buy_percentage` | number | no | Minimum 0. |

## Example request

```bash
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/dca" \
  -H "access-token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"position_ids":[123456,123457],"market_order":0,"dca_mode":"merged","trailing_buy":1,"trailing_buy_percentage":0.5}'
```

## Response

Example response (illustrative values):

```json
{
    "data": "DCA order(s) created."
}
```

Status codes: 200. Errors return JSON with `status`, `error` and `message`, plus a numeric `code` when the error comes from the API itself rather than the gateway.
