POST
https://api.cryptohopper.com/v1/hopper/{id}/position/dca
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 About scopes
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.
Example request
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}'
const response = await fetch('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/dca', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"position_ids": [
123456,
123457
],
"market_order": 0,
"dca_mode": "merged",
"trailing_buy": 1,
"trailing_buy_percentage": 0.5
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/dca",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"position_ids": [
123456,
123457
],
"market_order": 0,
"dca_mode": "merged",
"trailing_buy": 1,
"trailing_buy_percentage": 0.5
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/dca');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'access-token: YOUR_ACCESS_TOKEN',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'position_ids' => [
123456,
123457,
],
'market_order' => 0,
'dca_mode' => 'merged',
'trailing_buy' => 1,
'trailing_buy_percentage' => 0.5,
]),
]);
$data = json_decode(curl_exec($ch), true);
Parameters
Headers
| Name | Type | Required | Description |
|---|---|---|---|
access-token |
string | Required | The OAuth access token of the user. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string | Required | Hopper ID. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
position_ids | array of integer | Optional | |
market_order | number | Optional | Minimum 0. |
dca_mode | string | Optional | One of: merged, individual. |
trailing_buy | number | Optional | Minimum 0. |
trailing_buy_percentage | number | Optional | Minimum 0. |
Response
{
"data": "DCA order(s) created."
}