Skip to main content

Balances, Assets, and Pairs

The API provides endpoints to retrieve information about balances, asset values, and trading pairs on supported exchanges. This page outlines how to use these endpoints to monitor your account's asset balances, track historical values, and explore trading pairs available for trading.

/api/v1/balances​

  • Method: POST
  • Description: Retrieve the balances of assets across exchanges for the authenticated user.

Parameters​

This endpoint does not require any parameters in the request body.

Examples​

cURL​

curl -X POST "https://your-gunbot-instance.com:3000/api/v1/balances" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

JavaScript (fetch API)​

fetch('https://your-gunbot-instance.com:3000/api/v1/balances', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Python (requests library)​

import requests

url = 'https://your-gunbot-instance.com:3000/api/v1/balances'
headers = {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}

response = requests.post(url, headers=headers)
print(response.json())

Response​

[
{
"Asset": "USDT",
"Exchange": "binance",
"Available Qty": "442.84477668",
"On Order": "0.00000000"
},
{
"Asset": "PEPE",
"Exchange": "binance",
"Available Qty": "15837566.43915128",
"On Order": "0.00000000"
},
{
"Asset": "XRP",
"Exchange": "binance",
"Available Qty": "548.11945544",
"On Order": "0.00000000"
}
]

/api/v1/assets/total​

  • Method: POST
  • Description: Retrieve the historical total value of assets in the specified base currency over a time range.

Parameters​

ParameterTypeRequiredDescription
exchangestringYesExchange name (e.g., binance).
basestringYesBase currency to value the assets in (e.g., USDT).
startintYesStart timestamp in milliseconds since Unix epoch.
endintYesEnd timestamp in milliseconds since Unix epoch.

Examples​

cURL​

curl -X POST "https://your-gunbot-instance.com:3000/api/v1/assets/total" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"exchange": "binance",
"base": "USDT",
"start": 0,
"end": 1733307452718
}'

JavaScript (fetch API)​

const data = {
exchange: 'binance',
base: 'USDT',
start: 0,
end: Date.now()
};

fetch('https://your-gunbot-instance.com:3000/api/v1/assets/total', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Python (requests library)​

import requests
import time

url = 'https://your-gunbot-instance.com:3000/api/v1/assets/total'
headers = {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
}
data = {
"exchange": "binance",
"base": "USDT",
"start": 0,
"end": int(time.time() * 1000)
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

Response​

[
{
"id": 44,
"base_key": "binance/USDT",
"amount": 26.361644,
"timestamp": 1732789800000
},
{
"id": 85,
"base_key": "binance/USDT",
"amount": 26.131644,
"timestamp": 1732797000000
}
]

/api/v1/pairs​

  • Method: GET
  • Description: Retrieve a list of trading pairs available on the specified exchange.

Parameters​

ParameterTypeRequiredDescription
exchangestringYesExchange name (e.g., binance#3). URL-encoded.

Examples​

cURL​

curl -G "https://your-gunbot-instance.com:3000/api/v1/pairs" \
--data-urlencode "exchange=binance%233" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

JavaScript (fetch API)​

const params = new URLSearchParams({
exchange: 'binance#3'
});

fetch(`https://your-gunbot-instance.com:3000/api/v1/pairs?${params.toString()}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Python (requests library)​

import requests

url = 'https://your-gunbot-instance.com:3000/api/v1/pairs'
params = {
'exchange': 'binance#3'
}
headers = {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())

Response​

{
"status": "success",
"pairList": [
"BTC-ETH",
"BTC-LTC",
"BTC-BNB",
"BTC-NEO",
"ETH-QTUM",
"ETH-EOS",
"ETH-SNT"
]
}

/api/v1/pairs/detailed​

  • Method: GET
  • Description: Retrieve detailed information about trading pairs available on the specified exchange.

Parameters​

ParameterTypeRequiredDescription
exchangestringYesExchange name (e.g., binance#3). URL-encoded.

Examples​

cURL​

curl -G "https://your-gunbot-instance.com:3000/api/v1/pairs/detailed" \
--data-urlencode "exchange=binance%233" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

JavaScript (fetch API)​

const params = new URLSearchParams({
exchange: 'binance#3'
});

fetch(`https://your-gunbot-instance.com:3000/api/v1/pairs/detailed?${params.toString()}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Python (requests library)​

import requests

url = 'https://your-gunbot-instance.com:3000/api/v1/pairs/detailed'
params = {
'exchange': 'binance#3'
}
headers = {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())

Response​

{
"status": "success",
"pairList": {
"BTC": [
{
"pairName": "BTC-ETH",
"volume": 2448.96,
"low": "0.0371999999",
"high": "0.0387800000",
"change": "2.05"
},
{
"pairName": "BTC-LTC",
"volume": 204.38,
"low": "0.0012870000",
"high": "0.0014160000",
"change": "-2.53"
}
]
}
}