Download OpenAPI specification:
The Gunbot SDK JS enables you to programmatically interact with Gunbot, a self-hosted trading bot for crypto, ETFs and stocks.
It's a single API client with which you can control automated trading operations on many exchanges. Gunbot includes unique built-in strategies, it can also run custom strategy code in js. This client lets you orchestrate and monitor trading bots.
The API client accepts and returns data in JSON format.
It uses standard HTTP response codes to indicate request outcomes:
Gunbot Workflow
After completing these steps you can access market-data and trading endpoints. Gunbot will actively monitor and execute strategies for the specified pairs.
Encryption Helpers
Gunbot uses password encryption. Refer to the original documentation for helper snippets in JavaScript (Browser/Node.js), Bash and Python.
Supported Exchanges
Gunbot ships with native connectors for more than two dozen exchanges, covering spot, futures and on-chain derivatives.
Exchange | Spot | Futures / Perps | DeFi (on-chain) | Extra notes |
---|---|---|---|---|
Binance | ✔️ | ✔️ (USD-M & COIN-M) | Largest liquidity | |
Binance US | ✔️ | US-regulated arm | ||
Bitget | ✔️ | ✔️ (USDT & UM perps) | ||
Bybit | ✔️ | ✔️ (USDT & inverse perps) | ||
OKX | ✔️ | ✔️ (Perps & dated futures) | ||
Kraken | ✔️ | ✔️ (via Kraken Futures) | ||
KuCoin | ✔️ | |||
Gate.io | ✔️ | |||
MEXC | ✔️ | |||
BingX | ✔️ | |||
Crypto.com | ✔️ | |||
Huobi Global | ✔️ | |||
Bitfinex | ✔️ | |||
HitBTC | ✔️ | |||
Coinbase Advanced Trade | ✔️ | Former Coinbase Pro | ||
CEX.io | ✔️ | |||
Poloniex | ✔️ | |||
Alpaca (stocks & crypto) | ✔️ | |||
dYdX (v3/v4) | ✔️ | ✔️ | Perpetual DEX | |
HyperLiquid | ✔️ | ✔️ | ✔️ | DeFi perps |
PancakeSwap | ✔️ | ✔️ | BSC DEX | |
Bitmex / Bitmex Testnet | ✔️ |
Authenticate a user and obtain a JSON Web Token (JWT).
password required | string The user's encrypted password. See encryption helpers in the original documentation. |
{- "password": "ENC:your_encrypted_password_base64"
}
{- "status": "success",
- "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE4MTEwNjM4NTIsImlhdCI6MTczMzMXAwSnRyVi5JWmEwd0Vrc3lULnVCOVYxWXRObjAwRVB6NXlwTWo4UjRPblJoOFl1WGhxIn0.h1QiXh3EGl_LCqh0cgBTBle2ALgjSNhZPN9uwpvug6c"
}
Validate the current session's authentication status using the provided token.
{- "code": 200,
- "isDemo": false,
- "isRegistered": true,
- "isTwoFA": false,
- "metamask": false,
- "status": "success",
- "message": "Authenticated"
}
Retrieve historical total asset value in a base currency over a time range.
exchange required | string Exchange name (e.g., |
base required | string Base currency to value the assets in (e.g., |
start required | integer <int64> Start timestamp in milliseconds since Unix epoch. |
end required | integer <int64> End timestamp in milliseconds since Unix epoch. |
{- "exchange": "binance",
- "base": "USDT",
- "start": 0,
- "end": 1733307452718
}
[- {
- "id": 44,
- "base_key": "binance/USDT",
- "amount": 26.361644,
- "timestamp": 1732789800000
}
]
Retrieve a list of trading pairs for a specified exchange. The exchange
parameter should be URL-encoded if it contains special characters (e.g., #
as %23
).
exchange required | string Example: exchange=binance%233 Exchange name (e.g., |
{- "status": "success",
- "pairList": [
- "BTC-ETH",
- "BTC-LTC",
- "BTC-BNB"
]
}
Retrieve detailed trading pair information for a specified exchange. The exchange
parameter should be URL-encoded if it contains special characters.
exchange required | string Example: exchange=binance%233 Exchange name (e.g., |
{- "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"
}
]
}
}
Retrieve the entire application configuration.
{- "status": "success",
- "config": {
- "pairs": {
- "binance": {
- "USDT-PEPE": {
- "strategy": "channelmaestro",
- "enabled": true,
- "override": {
- "ADX_ENABLED": false
}
}
}
}
}
}
Update the entire configuration with a new object.
required | object (GunbotConfig) Represents the Gunbot configuration structure. This is a simplified placeholder; the actual config is deeply nested. |
{- "data": {
- "pairs": {
- "binance": {
- "USDT-PEPE": {
- "strategy": "channelmaestro",
- "enabled": true,
- "override": {
- "ADX_ENABLED": false
}
}
}
}
}
}
{- "status": "success",
- "config": {
- "pairs": {
- "binance": {
- "USDT-PEPE": {
- "strategy": "channelmaestro",
- "enabled": true,
- "override": {
- "ADX_ENABLED": false
}
}
}
}
}
}
Add a new trading pair to the configuration.
pair required | string The trading pair to add (e.g., |
exchange required | string The exchange name (e.g., |
object Default: {} (Optional) Specific settings for the trading pair. |
{- "pair": "USDT-PEPE",
- "exchange": "binance",
- "settings": { }
}
{- "status": "success"
}
Remove a trading pair from the configuration.
pair required | string The trading pair to remove (e.g., |
exchange required | string The exchange name (e.g., |
{- "pair": "USDT-PEPE",
- "exchange": "binance"
}
{- "status": "success"
}
Add a new trading strategy to the configuration.
name required | string The name of the strategy to add (e.g., |
object Default: {} (Optional) Specific settings for the strategy. |
{- "name": "myStrategy",
- "settings": { }
}
{- "status": "success"
}
Remove a trading strategy from the configuration.
name required | string The name of the strategy to remove. |
{- "name": "myStrategy"
}
{- "status": "success"
}
Retrieve the content of a specified AutoConfig variable file.
filename required | string The name of the file to retrieve. |
{- "filename": "string"
}
{- "this": 0.1855499735435755,
- "pnd": false
}
Write content to the autoconfig.json
file.
required | object or string The content to write into the file. |
{- "document": { }
}
{- "status": "success"
}
Retrieve the content of a specified backup config file.
filename required | string The name of the file to retrieve. |
{- "filename": "string"
}
{- "key": "value"
}
Write content to the custom strategy editor file.
required | object or string The content to write into the file. |
{- "document": { }
}
{- "status": "success"
}
Retrieve the content of a specific state file.
filename required | string The name of the file to retrieve. |
{- "filename": "string"
}
{- "orders": [
- {
- "time": 1733307452789,
- "pair": "USDT-XRP",
- "type": "sell"
}
], - "balances": { }
}
Retrieve the content of a specific custom strategy file. The response is the raw content of the file, likely JavaScript code, wrapped in a JSON object.
filename required | string The name of the file to retrieve. |
{- "filename": "string"
}
{ }
Write JavaScript code content to a specific custom strategy file.
filename required | string |
document required | string The content to write into the strategy file. |
{- "filename": "best_strategy.js",
- "document": "// Test Strategy"
}
{- "status": "success"
}
Delete a specific custom strategy file.
filename required | string The name of the file to retrieve. |
{- "filename": "string"
}
{- "status": "success"
}
Retrieve historical OHLCV candle data for a trading pair. The key
parameter (exchange/pair) must be URL-encoded.
key required | string Example: key=binance%2FUSDT-PEPE URL-encoded trading pair key (e.g., |
{- "data": {
- "close": [
- 0.1
], - "high": [
- 0.1
], - "low": [
- 0.1
], - "volume": [
- 0.1
], - "open": [
- 0.1
]
}
}
Retrieve current order book (bids and asks) for a trading pair. The key
parameter must be URL-encoded.
key required | string Example: key=binance%2FUSDT-PEPE URL-encoded trading pair key (e.g., |
{- "data": {
- "ask": [
- [
- 0.1,
- 0.1
]
], - "bid": [
- [
- 0.1,
- 0.1
]
]
}
}
Retrieve raw core memory data for a specific trading pair, optionally filtered by elements.
exchange required | string |
pair required | string |
elements | Array of strings or null Optional array of elements to filter. If omitted, returns all. |
{- "exchange": "binance",
- "pair": "BTC-ADA",
- "elements": [
- "ABP",
- "Bid"
]
}
{- "ABP": 0.000012009454969475356,
- "Bid": 0.00001137
}
Retrieve a snapshot of relevant core memory data for a single active trading pair. Data is slightly delayed and transformed.
exchange required | string |
pair required | string |
{- "exchange": "binance",
- "pair": "USDT-XRP"
}
{ }
Retrieve chart data, including candles and indicators, for a specific trading pair.
exchange required | string |
pair required | string |
{- "exchange": "binance",
- "pair": "USDT-XRP"
}
{ }
Retrieve chart timescale marks (annotations like buy/sell triggers) for a pair and interval.
exchange required | string Example: exchange=binance |
pair required | string Example: pair=USDT-XRP |
interval required | string Example: interval=15 Time interval in minutes. |
startTime required | string Example: startTime=0 Start time (UNIX timestamp seconds). |
endTime required | string Example: endTime=2114377200 End time (UNIX timestamp seconds). |
[- {
- "exchange": "binance",
- "pair": "USDT-PEPE",
- "id": "3313",
- "time": 1733391240,
- "color": "rgba(38, 166, 154, 0.8)",
- "label": "▲",
- "tooltip": [
- "",
- "🟩 1733391279657 convert",
- "Buy 9083536.00028041 PEPE",
- "@ 0.00002162 USDT",
- "Total: 196.386 USDT"
]
}
]
Retrieve an overview of PNL data, summarized over time periods and trading pairs.
timezone required | string IANA timezone string (e.g., |
keys required | Array of strings Array of trading keys (e.g., |
object or null |
{- "timezone": "Europe/Amsterdam",
- "keys": [
- "All"
], - "dateRange": {
- "startDate": 1733743909461,
- "endDate": 1734348709461
}
}
{- "today": {
- "pnl": 0,
- "perPair": { }
}, - "total": {
- "pnl": 172.26520619518234,
- "numberOfTrades": 106
}, - "unit": "USDT"
}
Retrieve daily PNL data for a specific trading key within a time range. The key
parameter must be URL-encoded.
key required | string Example: key=binance%2FUSDT-XRP URL-encoded trading key (e.g. |
startTimestamp required | integer <int64> Start timestamp (ms). |
endTimestamp required | integer <int64> Example: endTimestamp=1733307452623 End timestamp (ms). |
{- "dateRangeDailyHistory": [
- { }
], - "unmatchedBaseValuePerDateRange": 0
}
Retrieve paginated daily PNL data for a specific trading key. The key
parameter must be URL-encoded.
key required | string Example: key=binance%2FUSDT-XRP URL-encoded trading key. |
pageNum required | integer Example: pageNum=1 Page number. |
pageSize required | integer Example: pageSize=10 Records per page. |
endTime required | integer <int64> Example: endTime=1733307452649 End timestamp (ms). |
{- "totalSize": 0,
- "data": [
- { }
]
}
Retrieve total PNL sum and investment for an exchange key over a time range. The exchange
parameter (exchange key) must be URL-encoded.
exchange required | string Example: exchange=binance%2FUSDT-XRP URL-encoded exchange key (e.g. |
startTimestamp required | integer <int64> Start timestamp (ms). |
endTimestamp required | integer <int64> Example: endTimestamp=1733307452649 End timestamp (ms). |
{- "tournamentData": {
- "sommaPnl": "0.00000000",
- "invested": "0.00000000"
}, - "data": [
- { }
]
}
Retrieve total PNL for a specific trading key. The key
parameter must be URL-encoded.
key required | string Example: key=binance%2FUSDT-XRP URL-encoded trading key. |
{ }
Start the Gunbot system. Returns current configuration without private keys.
{- "pairs": {
- "binance": {
- "USDT-PEPE": {
- "strategy": "channelmaestro",
- "enabled": true,
- "override": {
- "ADX_ENABLED": false
}
}
}
}
}
Stop the Gunbot system. Returns current configuration without private keys.
{- "pairs": {
- "binance": {
- "USDT-PEPE": {
- "strategy": "channelmaestro",
- "enabled": true,
- "override": {
- "ADX_ENABLED": false
}
}
}
}
}
Edit license keys for a wallet, optionally verifying with an exchange.
wallet required | string |
required | object Object containing new license data. Use the entire config.exchanges object. For new keys, set isEncrypted to false. |
verifyExchange required | string Name of an exchange with valid, registered credentials to authenticate the request. |
{- "wallet": "0xYourWalletAddress",
- "newLicenses": { },
- "verifyExchange": "binance"
}
{- "status": "success"
}
Place a limit buy order.
required | object (TradeLimitOrderData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1,
- "price": 50000
}
}
{- "status": "success",
- "message": "Order sent"
}
Place a market buy order.
required | object (TradeMarketOrderData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1
}
}
{- "status": "success",
- "message": "Order sent"
}
Place a limit sell order.
required | object (TradeLimitOrderData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1,
- "price": 52500
}
}
{- "status": "success",
- "message": "Order sent"
}
Place a market sell order.
required | object (TradeMarketOrderData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1
}
}
{- "status": "success",
- "message": "Order sent"
}
Cancel an existing order.
required | object (TradeCancelData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "id": "357044",
- "price": 50000,
- "type": "limit"
}
}
{- "status": "success",
- "message": "Order sent"
}
Retrieve locally stored order history for a trading pair. The key
parameter must be URL-encoded.
key required | string Example: key=binance%2FUSDT-XRP URL-encoded exchange/pair key (e.g., |
{- "data": [
- {
- "time": 0,
- "pair": "string",
- "type": "buy",
- "rate": 0.1,
- "amount": 0.1,
- "id": 0,
- "cost": 0.1,
- "toCancel": true,
- "fees": 0.1,
- "baseValue": 0.1,
- "costProceed": 0.1,
- "averagePrice": 0.1,
- "pnlPrice": 0.1,
- "balance": 0.1,
- "baseBalance": 0.1,
- "inventory_cost": 0.1,
- "ABP": 0.1,
- "pnl": 0.1
}
]
}
Retrieve orders from the current day for multiple trading pairs. Individual keys in keys[]
array must be URL-encoded if they contain special characters.
timezone required | string Example: timezone=America/New_York IANA timezone (e.g., |
keys[] required | Array of strings Example: keys[]=binance/USDT-XRP&keys[]=mex_gunthy/USDT-DOGE Array of exchange/pair keys. Each key should be URL-encoded if needed. |
{- "days": [ ],
- "orders": [ ],
- "closeOrders": [ ]
}
Retrieve paginated orders for a trading pair. The key
parameter must be URL-encoded.
key required | string Example: key=binance%2FUSDT-XRP URL-encoded exchange/pair key. |
page required | integer >= 0 Page number (0-indexed). |
pageSize required | integer >= 1 Example: pageSize=10 Records per page. |
{- "total": 0,
- "page": 0,
- "data": [ ]
}
Retrieve paginated orders for multiple trading pairs. Individual keys in keys[]
array must be URL-encoded if needed.
keys[] required | Array of strings Example: keys[]=binance/USDT-XRP&keys[]=mex_gunthy/USDT-DOGE Array of exchange/pair keys. Each key should be URL-encoded if needed. |
page required | integer >= 0 Page number (0-indexed). |
pageSize required | integer >= 1 Example: pageSize=10 Records per page. |
{- "total": 0,
- "totalCount": 0,
- "page": 0,
- "data": [ ]
}
Place a stop-limit buy order on Binance.
required | object (TradeStopLimitData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1,
- "stopPrice": 49900,
- "limitPrice": 49850
}
}
{- "status": "success",
- "message": "Order sent"
}
Place a stop-limit sell order on Binance.
required | object (TradeStopLimitData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1,
- "stopPrice": 50100,
- "limitPrice": 50150
}
}
{- "status": "success",
- "message": "Order sent"
}
Place a trailing stop buy order on Binance. price
is the reference price.
required | object (TradeTrailingStopData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1,
- "price": 50000,
- "stopPrice": 49900
}
}
{- "status": "success",
- "message": "Order sent"
}
Place a trailing stop sell order on Binance. price
is the reference price.
required | object (TradeTrailingStopData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1,
- "price": 52500,
- "stopPrice": 52550
}
}
{- "status": "success",
- "message": "Order sent"
}
Place an OCO (One-Cancels-the-Other) buy order on Binance.
required | object (TradeOcoData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1,
- "price": 50000,
- "stopPrice": 49900,
- "limit": 49850
}
}
{- "status": "success",
- "message": "Order sent"
}
Place an OCO (One-Cancels-the-Other) sell order on Binance.
required | object (TradeOcoData) |
{- "data": {
- "exch": "binance",
- "pair": "USDT-BTC",
- "amt": 1,
- "price": 52500,
- "stopPrice": 52550,
- "limit": 52600
}
}
{- "status": "success",
- "message": "Order sent"
}
Close an open position at a specified limit price on Bybit (futures).
required | object (TradeCloseLimitData) |
{- "data": {
- "exch": "bybit",
- "pair": "USDT-BTC-LONG",
- "amt": 1,
- "price": 51000
}
}
{- "status": "success",
- "message": "Order sent"
}
Close an open position at the current market price on Bybit (futures).
required | object (TradeCloseMarketData) |
{- "data": {
- "exch": "bybit",
- "pair": "USDT-BTC-LONG",
- "amt": 1
}
}
{- "status": "success",
- "message": "Order sent"
}