POST
https://api.cryptohopper.com/v1/hopper/{id}/position/merge
Merges the given open positions into one position per coin, with the combined amount at the average rate. Positions on hold, already sold or with an open order are left out.
OAuth scope:
read About scopes
position_id must be an array with at least 2 position IDs. The response is the same when none of the positions could be merged. Not available for copy bots, exchange arbitrage, market maker and grid bots.
Example request
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/merge" \
-H "access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"position_id":[123456,123457]}'
const response = await fetch('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/merge', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"position_id": [
123456,
123457
]
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/merge",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"position_id": [
123456,
123457
]
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/merge');
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_id' => [
123456,
123457,
],
]),
]);
$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_id | array of integer | Required |
Response
{
"data": "Positions have been merged."
}