Configuration and File Management
The Configuration and File Management API endpoints provide tools to manage application settings, trading pairs, strategies, and related files. These endpoints allow you to retrieve, update, add, or remove configurations, as well as manage various file types such as backup files, AutoConfig variables, and custom strategies.
The following sections detail the available endpoints, parameters, request examples, and sample responses, enabling precise control and efficient management of Gunbot's configuration and file system.
/api/v1/config/full
- Method:
GET
- Description: Retrieve the entire configuration settings of the application.
Parameters
This endpoint does not require any parameters.
Examples
cURL
curl -X GET "http://localhost:5051/api/v1/config/full" \
-H "Authorization: Bearer YOUR_TOKEN"
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/config/full', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/config/full'
headers = {
'Authorization': 'Bearer YOUR_TOKEN'
}
response = requests.get(url, headers=headers)
print(response.json())
Response
{
"status": "success",
"config": {
"pairs": {
"binance": {
"USDT-PEPE": {
"strategy": "channelmaestro",
"enabled": true,
"override": {
"ADX_ENABLED": false,
"ADX_LEVEL": 25,
"ATRX": 0.5,
"ATR_PERIOD": "14",
// Truncated for brevity
}
}
}
}
}
}
/api/v1/config/update
- Method:
POST
- Description: Update the entire configuration with a new configuration object.
Parameters
Name | Type | Description |
---|---|---|
data | JSON | The new configuration object to apply. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/config/update" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"data": {
// Your new configuration data
}
}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/config/update', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
// Your new configuration data
}
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/config/update'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'data': {
# Your new configuration data
}
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"status": "success",
"config": {
// Your updated configuration data
}
}
/api/v1/config/pair/add
- Method:
POST
- Description: Add a new trading pair to the configuration.
Parameters
Name | Type | Description |
---|---|---|
pair | string | The trading pair to add (e.g., USDT-PEPE ). |
exchange | string | The exchange name (e.g., binance ). |
settings | object | (Optional) Specific settings for the trading pair. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/config/pair/add" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"pair": "USDT-PEPE",
"exchange": "binance",
"settings": {}
}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/config/pair/add', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
pair: 'USDT-PEPE',
exchange: 'binance',
settings: {}
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/config/pair/add'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'pair': 'USDT-PEPE',
'exchange': 'binance',
'settings': {}
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"status": "success"
}
/api/v1/config/pair/remove
- Method:
POST
- Description: Remove an existing trading pair from the configuration.
Parameters
Name | Type | Description |
---|---|---|
pair | string | The trading pair to remove (e.g., USDT-PEPE ). |
exchange | string | The exchange name (e.g., binance ). |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/config/pair/remove" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"pair": "USDT-PEPE",
"exchange": "binance"
}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/config/pair/remove', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
pair: 'USDT-PEPE',
exchange: 'binance'
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/config/pair/remove'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'pair': 'USDT-PEPE',
'exchange': 'binance'
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"status": "success"
}
/api/v1/config/strategy/add
- Method:
POST
- Description: Add a new trading strategy to the configuration.
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the strategy to add (e.g., myStrategy ). |
settings | object | (Optional) Specific settings for the strategy. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/config/strategy/add" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "myStrategy",
"settings": {}
}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/config/strategy/add', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'myStrategy',
settings: {}
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/config/strategy/add'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'name': 'myStrategy',
'settings': {}
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"status": "success"
}
/api/v1/config/strategy/remove
- Method:
POST
- Description: Remove an existing trading strategy from the configuration.
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the strategy to remove. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/config/strategy/remove" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "myStrategy"}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/config/strategy/remove', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'myStrategy'
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/config/strategy/remove'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'name': 'myStrategy'
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"status": "success"
}
/api/v1/files/acvar
- Method:
GET
- Description: List filenames of available AutoConfig variable files.
Parameters
This endpoint does not require any parameters.
Examples
cURL
curl -X GET "http://localhost:5051/api/v1/files/acvar" \
-H "Authorization: Bearer YOUR_TOKEN"
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/acvar', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/acvar'
headers = {
'Authorization': 'Bearer YOUR_TOKEN'
}
response = requests.get(url, headers=headers)
print(response.json())
Response
{
"status": "success",
"result": [
"autoconfig-pairVariables.json",
"autoconfig-variables.json"
]
}
/api/v1/files/acvar/get
- Method:
POST
- Description: Retrieve the contents of a specified AutoConfig variable file.
Parameters
Name | Type | Description |
---|---|---|
filename | string | The name of the AutoConfig variable file to retrieve. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/acvar/get" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"filename": "autoconfig-variables.json"}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/acvar/get', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filename: 'autoconfig-variables.json'
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/acvar/get'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'filename': 'autoconfig-variables.json'
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"this": 0.1855499735435755,
"pnd": false
}
/api/v1/files/autoconfig/write
- Method:
POST
- Description: Write content to the
autoconfig.json
file.
Parameters
Name | Type | Description |
---|---|---|
document | JSON | The content to write into autoconfig.json . |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/autoconfig/write" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"document": {
"key": "value"
}
}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/autoconfig/write', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
document: {
key: 'value'
}
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/autoconfig/write'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'document': {
'key': 'value'
}
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"status": "success"
}
/api/v1/files/backup
- Method:
POST
- Description: List available backup files.
Parameters
This endpoint does not require any parameters.
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/backup" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/backup', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/backup'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Response
{
"status": "success",
"result": [
"autoconfig.json.1623252417412",
"autoconfig.json.1623252547918",
"autoconfig.json.1623312859755",
// Truncated for brevity
]
}
/api/v1/files/backup/get
- Method:
POST
- Description: Retrieve the contents of a specified backup file.
Parameters
Name | Type | Description |
---|---|---|
filename | string | The name of the backup file to retrieve. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/backup/get" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"filename": "autoconfig.json.1624608048720"}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/backup/get', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filename: 'autoconfig.json.1624608048720'
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/backup/get'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'filename': 'autoconfig.json.1624608048720'
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"manageOverrides_binance": {
"pairs": {
"exclude": "UP,DOWN,1L,2L,3L,1S,2S,3S",
"include": "USDT-",
"exchange": "binances",
"maxPairs": 6
},
"filters": {},
"overrides": {},
// Truncated for brevity
}
}
/api/v1/files/custom-editor/get
- Method:
POST
- Description: Retrieve the contents of the custom strategy editor file.
Parameters
This endpoint does not require any parameters.
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/custom-editor/get" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/custom-editor/get', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/custom-editor/get'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Response
{}
/api/v1/files/custom-editor/write
- Method:
POST
- Description: Write content to the custom strategy editor file.
Parameters
Name | Type | Description |
---|---|---|
document | JSON | The content to write into the custom editor file. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/custom-editor/write" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"document": {
// Your custom strategy data
}
}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/custom-editor/write', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
document: {
// Your custom strategy data
}
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/custom-editor/write'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'document': {
# Your custom strategy data
}
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"status": "success"
}
/api/v1/files/state
- Method:
GET
- Description: List filenames of available state files.
Parameters
This endpoint does not require any parameters.
Examples
cURL
curl -X GET "http://localhost:5051/api/v1/files/state" \
-H "Authorization: Bearer YOUR_TOKEN"
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/state', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/state'
headers = {
'Authorization': 'Bearer YOUR_TOKEN'
}
response = requests.get(url, headers=headers)
print(response.json())
Response
{
"status": "success",
"result": [
"binance-USDT-ETHFI-state.json",
"binance-USDT-PEPE-state.json",
"binance-USDT-XRP-state.json"
]
}
/api/v1/files/state/get
- Method:
POST
- Description: Retrieve the contents of a specific state file.
Parameters
Name | Type | Description |
---|---|---|
filename | string | The name of the state file to retrieve. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/state/get" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"filename": "binance-USDT-XRP-state.json"}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/state/get', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filename: 'binance-USDT-XRP-state.json'
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/state/get'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'filename': 'binance-USDT-XRP-state.json'
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"orders": [
{
"time": 1733307452789,
"pair": "USDT-XRP",
"type": "sell",
"rate": 2.3,
"amount": 0.1,
"id": 357044,
"cost": 0.22999999999999998
}
],
"balances": {
// Additional state data
}
}
/api/v1/files/strategy
- Method:
GET
- Description: List filenames of available custom strategy files.
Parameters
This endpoint does not require any parameters.
Examples
cURL
curl -X GET "http://localhost:5051/api/v1/files/strategy" \
-H "Authorization: Bearer YOUR_TOKEN"
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/strategy', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/strategy'
headers = {
'Authorization': 'Bearer YOUR_TOKEN'
}
response = requests.get(url, headers=headers)
print(response.json())
Response
{
"status": "success",
"result": [
"ema-rsi-gain-sl_strategy.js",
"trend.js",
"stoch-supports_strategy.js"
]
}
/api/v1/files/strategy/get
- Method:
POST
- Description: Retrieve the contents of a specific custom strategy file.
Parameters
Name | Type | Description |
---|---|---|
filename | string | The name of the strategy file to retrieve. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/strategy/get" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"filename": "best_strategy.js"}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/strategy/get', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filename: 'best_strategy.js'
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/strategy/get'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'filename': 'best_strategy.js'
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
// Contents of the strategy file
}
/api/v1/files/strategy/write
- Method:
POST
- Description: Write content to a specific custom strategy file.
Parameters
Name | Type | Description |
---|---|---|
filename | string | The name of the strategy file to write to. |
document | string | The content to write into the strategy file. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/strategy/write" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"filename": "best_strategy.js",
"document": "// Test Strategy"
}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/strategy/write', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filename: 'best_strategy.js',
document: '// Test Strategy'
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/strategy/write'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'filename': 'best_strategy.js',
'document': '// Test Strategy'
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"status": "success"
}
/api/v1/files/strategy/delete
- Method:
POST
(Note: The method isPOST
based on the example code, even though it may logically beDELETE
.) - Description: Delete a specific custom strategy file.
Parameters
Name | Type | Description |
---|---|---|
filename | string | The name of the strategy file to delete. |
Examples
cURL
curl -X POST "http://localhost:5051/api/v1/files/strategy/delete" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"filename": "best_strategy.js"}'
JavaScript (fetch API)
fetch('http://localhost:5051/api/v1/files/strategy/delete', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filename: 'best_strategy.js'
})
})
.then(response => response.json())
.then(data => console.log(data));
Python (requests library)
import requests
url = 'http://localhost:5051/api/v1/files/strategy/delete'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
payload = {
'filename': 'best_strategy.js'
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"status": "success"
}