PATCH
https://api.cryptohopper.com/v1/strategy/{strategy_id}
Updates one of the user's own strategies. Fields you leave out or send empty keep their current value.
OAuth scope:
read manage About scopes
Unlike Create strategy, image here is image data encoded as base64; it is uploaded and cropped to 600 by 430 pixels. min_buys or min_sells of 0 keep the current value. Each config item needs id, name, chartperiod, params, type, candle_pattern and keep_signal, and may also have description, necessary, min_buys, min_sells, signal_when, signal_when_value, candle_value and exclusive; any other key makes the config invalid. config may also be sent as a JSON string.
Example request
curl -X PATCH "https://api.cryptohopper.com/v1/strategy/STRATEGY_ID" \
-H "access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"RSI and SAR v2","description":"Tighter RSI thresholds","config":[{"id":"121","name":"RSI with region crossovers (RSI)","type":"buy","params":{"candle_value":{"type":"select","name":"OHLCV Value","options":["open","close","high","low","volume"],"default":"close"},"period":{"type":"number","step":1,"min":1,"max":500,"name":"RSI Period","default":14},"oversold":{"type":"number","step":0.01,"min":0,"max":100,"name":"Oversold threshold","default":30},"overbought":{"type":"number","step":0.01,"min":0,"max":100,"name":"Overbought threshold","default":70},"region_type":{"type":"select","name":"Signal on region","options":["in","out"],"default":"in"}},"chartperiod":"900","candle_pattern":0,"necessary":1,"keep_signal":0}],"min_buys":1}'
const response = await fetch('https://api.cryptohopper.com/v1/strategy/STRATEGY_ID', {
method: 'PATCH',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "RSI and SAR v2",
"description": "Tighter RSI thresholds",
"config": [
{
"id": "121",
"name": "RSI with region crossovers (RSI)",
"type": "buy",
"params": {
"candle_value": {
"type": "select",
"name": "OHLCV Value",
"options": [
"open",
"close",
"high",
"low",
"volume"
],
"default": "close"
},
"period": {
"type": "number",
"step": 1,
"min": 1,
"max": 500,
"name": "RSI Period",
"default": 14
},
"oversold": {
"type": "number",
"step": 0.01,
"min": 0,
"max": 100,
"name": "Oversold threshold",
"default": 30
},
"overbought": {
"type": "number",
"step": 0.01,
"min": 0,
"max": 100,
"name": "Overbought threshold",
"default": 70
},
"region_type": {
"type": "select",
"name": "Signal on region",
"options": [
"in",
"out"
],
"default": "in"
}
},
"chartperiod": "900",
"candle_pattern": 0,
"necessary": 1,
"keep_signal": 0
}
],
"min_buys": 1
})
});
const data = await response.json();
import requests
response = requests.patch(
"https://api.cryptohopper.com/v1/strategy/STRATEGY_ID",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"name": "RSI and SAR v2",
"description": "Tighter RSI thresholds",
"config": [
{
"id": "121",
"name": "RSI with region crossovers (RSI)",
"type": "buy",
"params": {
"candle_value": {
"type": "select",
"name": "OHLCV Value",
"options": [
"open",
"close",
"high",
"low",
"volume"
],
"default": "close"
},
"period": {
"type": "number",
"step": 1,
"min": 1,
"max": 500,
"name": "RSI Period",
"default": 14
},
"oversold": {
"type": "number",
"step": 0.01,
"min": 0,
"max": 100,
"name": "Oversold threshold",
"default": 30
},
"overbought": {
"type": "number",
"step": 0.01,
"min": 0,
"max": 100,
"name": "Overbought threshold",
"default": 70
},
"region_type": {
"type": "select",
"name": "Signal on region",
"options": [
"in",
"out"
],
"default": "in"
}
},
"chartperiod": "900",
"candle_pattern": 0,
"necessary": 1,
"keep_signal": 0
}
],
"min_buys": 1
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/strategy/STRATEGY_ID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'access-token: YOUR_ACCESS_TOKEN',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'RSI and SAR v2',
'description' => 'Tighter RSI thresholds',
'config' => [
[
'id' => '121',
'name' => 'RSI with region crossovers (RSI)',
'type' => 'buy',
'params' => [
'candle_value' => [
'type' => 'select',
'name' => 'OHLCV Value',
'options' => [
'open',
'close',
'high',
'low',
'volume',
],
'default' => 'close',
],
'period' => [
'type' => 'number',
'step' => 1,
'min' => 1,
'max' => 500,
'name' => 'RSI Period',
'default' => 14,
],
'oversold' => [
'type' => 'number',
'step' => 0.01,
'min' => 0,
'max' => 100,
'name' => 'Oversold threshold',
'default' => 30,
],
'overbought' => [
'type' => 'number',
'step' => 0.01,
'min' => 0,
'max' => 100,
'name' => 'Overbought threshold',
'default' => 70,
],
'region_type' => [
'type' => 'select',
'name' => 'Signal on region',
'options' => [
'in',
'out',
],
'default' => 'in',
],
],
'chartperiod' => '900',
'candle_pattern' => 0,
'necessary' => 1,
'keep_signal' => 0,
],
],
'min_buys' => 1,
]),
]);
$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 |
|---|---|---|---|
strategy_id |
string | Required | ID of the strategy. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Optional | |
description | string | Optional | |
image | string | Optional | |
config | object | Optional | |
id | number | Optional | Minimum 0. |
name | string | Optional | |
chartperiod | string | Optional | |
params | string | Optional | |
type | string | Optional | |
description | string | Optional | |
signal_when | string | Optional | |
signal_when_value | string | Optional | |
candle_value | string | Optional | |
candle_pattern | string | Optional | |
keep_signal | string | Optional | |
min_buys | number | Optional | Minimum 0. |
min_sells | number | Optional | Minimum 0. |
Response
{
"data": {
"strategy_id": "369000",
"message": "Strategy has been saved."
}
}