POST
https://api.cryptohopper.com/v1/hopper/{id}/position/setpositionsetting
Changes one or more settings on the given open positions: take profit, auto close time, stop-loss on or off, stop-loss percentage, trailing stop-loss on or off, trailing arm percentage and trailing percentage.
OAuth scope:
read manage About scopes
setting is an object of setting names and values. Allowed names: take_profit, auto_close_time (Unix timestamp in seconds; 0 or a time in the past turns auto close off), stop_loss_enabled, stop_loss_percentage, trailing_enabled, trailing_arm_percentage, trailing_percentage. Other names are ignored. setting can also be a comma separated list of names, with the values sent as top-level body fields. If some but not all of several settings fail, data is null. 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/setpositionsetting" \
-H "access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"position_ids":[123456],"setting":{"take_profit":3.5,"stop_loss_enabled":1,"stop_loss_percentage":2}}'
const response = await fetch('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/setpositionsetting', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"position_ids": [
123456
],
"setting": {
"take_profit": 3.5,
"stop_loss_enabled": 1,
"stop_loss_percentage": 2
}
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/setpositionsetting",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"position_ids": [
123456
],
"setting": {
"take_profit": 3.5,
"stop_loss_enabled": 1,
"stop_loss_percentage": 2
}
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/setpositionsetting');
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,
],
'setting' => [
'take_profit' => 3.5,
'stop_loss_enabled' => 1,
'stop_loss_percentage' => 2,
],
]),
]);
$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 | |
setting | object | Optional | |
take_profit | number | Optional | Minimum 0. |
auto_close_time | number | Optional | Minimum 0. |
stop_loss_percentage | number | Optional | Minimum 0. |
stop_loss_enabled | integer | Optional | |
trailing_enabled | integer | Optional | |
trailing_arm_percentage | number | Optional | Minimum 0. |
trailing_percentage | number | Optional | Minimum 0. |
Response
{
"data": "All updates successfull."
}