POST
https://api.cryptohopper.com/v1/hopper/{id}/position/split/{position_id}
Splits one open position into two positions, one holding the given percentage of the amount and one holding the rest.
OAuth scope:
read manage About scopes
percentage must be above 0 and at most 100; it defaults to 50. Returns an error when the position is on hold, already sold, has an open order or is too small to split. Not available for copy bots.
Example request
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/split/POSITION_ID" \
-H "access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"percentage":25}'
const response = await fetch('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/split/POSITION_ID', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"percentage": 25
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/split/POSITION_ID",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"percentage": 25
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/split/POSITION_ID');
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([
'percentage' => 25,
]),
]);
$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 |
|---|---|---|---|
position_id |
string | Required | Open position ID. |
id |
string | Required | Hopper ID. |
Response
{
"data": "Positions have been splitted."
}