Gunbot settings

Important: you don’t need to edit config.js manually when you are using the Gunbot GUI. All settings described on this page can be changed from the GUI.

All Gunbot settings are done in a single file named “config.js”. This is where you set up your exchange API keys, add pairs and define your strategies. When the config file is overwritten while Gunbot is running, the changed settings will be loaded automatically. Below you’ll find detailed explanations of all the options in the configuration file.

Make sure that no parameters are removed when setting it up. Make sure the JSON-formatting stays intact. If you are unsure about your config file, you can validate it on https://jsonlint.com (or a similar JSON validator).

Exchanges

In this section you insert your API key and secret for the exchanges you want to trade on. You don’t need to remove the exchanges you do not want to trade on.

You can run pairs on multiple exchanges in one Gunbot instance. Exchanges cycle independent from each other.

If you want to use a different API key for trading than the one you initially registered with us, no problem! You can just use a new key without contacting support. Do make sure you keep the initially registered key active.

The following options exist for configuring exchange keys. Only fill in those that you actually need, and registered a Gunbot licence on.

Required permissions for API keys are different for each exchange.

ParameterValueDescription
masterkeyYOURMASTERAPIKEYThe exchange key used for your Gunbot purchase (or the last registered key).
Used for authentication with the Gunbot license server. Not necessarily used for trading, key needs to exist at the exchange.
mastersecretYOURMASTERSECRETKEYThe secret belonging to the key used for your Gunbot purchase (or the last key support swapped).
keyYOURAPIKEYThe exchange API key you want to use for trading with Gunbot.
Needs to be on the same exchange account as the masterkey and needs to have trading permissions. You can also enter the master key here again to trade with this key.
secretYOURSECRETKEYChange this value to the secret belonging to your API key that you want to use for trading.
clientIdYOURCLIENTIDEnter your CEX client ID. Only relevant for CEX.
passphraseYOURPASSPHRASEEnter your GDAX API passphrase. Only relevant for GDAX.
In case you use a different trading key than your master key, make sure that both keys use the same passphrase.
passwordYOUR TRADING PASSWORDEnter your KuCoin trading password. This setting is only relevant for KuCoin.
In case you use a different trading key than your master key, make sure that both keys use the same passphrase.
delay10Values: numerical – represents time in seconds.
Bot will delay processing a new pair for a set amount of seconds.Useful for when Gunbot requests data faster than the exchange API is allowing you to do. As the needed delay depends on the amount of pairs and the speed your system needs to cycle pairs, there are no recommended values.This is the exchange specific setting for delaying pair processing.

YOU ARE RESPONSIBLE FOR YOUR OWN KEYS. DO NOT LOSE YOUR MASTER KEY AND MASTER SECRET. EVER.

Make absolutely sure you safely keep a copy of your master key and secret. Never deactivate two factor authentication at your exchange when not strictly needed because this will often lead to losing your API keys.

Pairs

In the pairs sections you can configure which pairs to use, on which exchange and which strategy should be used, optional overrides are possible. You need to remove any example pairs in the config.js file that you are not planning to use. Pairs need to be written in CAPS.

The set base coin is the one you want to accumulate. You use the base coin to buy another asset, and sell it back for profit in the base currency. Gunbot will always sell all assets when selling, and will buy according to your set trading limit.

Gunbot normalizes pair notation, so all pairs for all exchanges except Bitmex follow the same logic:

BASECOIN-QUOTECOIN

All pairs with BTC as base currency are written like:

BTC-ETH, BTC-OK, BTC-XLM

All pairs with USDT as base currency are written like:

USDT-BTC, USDT-ETH, USDT-XMR

For a few coins on Bitfinex, the API display name is required. These are:

IOTA = IOT

DASH = DSH

QTUM = QTM

DATA = DAT

QASH = QSH

Kraken calls Bitcoin XBT, this is not an allowed input for pairs in Gunbot, use BTC instead.

Valid pair names for Bitmex

Pairs on Bitmex use almost the same symbols as on Bitmex itself, but with a hyphen-minus between the two asset names. Example: XBT-USD

Warning: Take care when you want to trade pairs that cross-over. You will need to set KEEP_QUOTE for each pair to make sure you leave no pair unfunded.

The cause is that you only have one wallet for each coin in your exchange account. That results in a funds battle if you run pairs that cross each other. So for example, BTC-ETH and ETH-XMR are crossed. If KEEP_QUOTE is not set correctly, BTC-ETH will sell all your ETH, and leave ETH-XMR unfunded.

Overrides

Settings made in a strategy are global and apply to all pairs configured to use that strategy. In case you want specific pairs to use different values for some parameters, you can override this per pair.

For example: Configuring a pair to use bb as strategy and override the MIN_VOLUME_TO_SELL value set in the bb strategy would look like this in config.js:

"BTC-DASH": { "strategy": "bb", "enabled": true, "override": {"MIN_VOLUME_TO_SELL": 0.01}}

By setting “enabled” to false, Gunbot will not cycle a pair until it is enabled again.

If you want to override settings for pairs using the GUI, add the desired parameters on the pairs page.

modify-pair

Strategy settings

The settings available for configuring strategies are different for each strategy. Detailed descriptions of all parameters can be found on the pages describing individual strategies. The margin versions for each strategy have separate pages because the logic for opening and closing longs and shorts is different from regular trading.

There is one setting in config.js that has no functional effect in strategies: IS_MARGIN_STRAT is only used by the GUI to switch between showing settings for spot or margin trading.

Bot settings

These settings define the core behavior of Gunbot.

ParameterDefault valueDescription
MULTIPLE_BASEfalseValues: true or false.
Use this option to trade pairs with cross-over between quote and base (for example BTC-ETH and ETH-ADA). When enabled, Gunbot won’t sell all available quote units when selling, instead it will only sell the invested funds. Also affects the TradingView add-on.This parameter is irrelevant for trading at Bitmex.
debugfalseValues: true or false.
Used to show debug messages in the bot, when set to true. Only use this if you really need to debug something.
BOT_DELAY1Values: numerical – represents time in seconds.
Bot will delay processing a new pair for a set amount of seconds.Useful for when Gunbot requests data faster than the exchange API is allowing you to do. As the needed delay depends on the amount of pairs and the speed your system needs to cycle pairs, there are no recommended values.This is the global setting for bot delay, when it’s set higher than the exchange specific delay in the exchange section, BOT_DELAY applies.
BOT_CCLEAN2Values: numerical – represents time in hours.
This parameter forces the Gunbot cache to be cleaned by restarting the bot every x hours. This setting does not trigger TRADES_TIMEOUT.Only set this to a low value when your bot actually has problems not trading after a longer period of use.
CANCEL_ORDERS_ENABLEDtrueValues: true or false.
When set to true, the bot will cancel unfilled or partially filled orders when the price has moved away from the buy or sell price. Set this to false if you also trade manually to prevent the bot from cancelling your open orders.Simulated Fill Or Kill (FOK) When an order is not or only partially filled and gets cancelled, Gunbot will attempt to fill the order by replacing it at current bid/ask.For buy buy orders this means that FOK orders are sent as long as the number of quote units held are worth less than TRADING_LIMIT and the difference is higher than MIN_VOLUME_TO_BUY.For sell orders this means that FOK orders are sent as long as the number of quote units held (minus KEEP_QUOTE, if used) are worth more than MIN_VOLUME_TO_SELL and bid is higher than the break-even point.
CANCEL_ORDERS_CYCLE_CAPtrueValues: numerical – represents a number of rounds.
This only applies when using MAKER_FEES. Set the number of rounds that pending orders need to be kept open. After this number of rounds passes, Gunbot will cancel the pending order.
RESERVE_PILE_UPfalseValues: true or false.
When set to true, trading gains will be automatically added to the funds reserve.
interval_ticker_update25000Values: numerical – represents time in milliseconds.
Deprecated.
period_storage_ticker2000Values: numerical – represent a number.
Deprecated.
timeout_buy60000Values: numerical – represent time in milliseconds.
This is an internal timeout that prevents the bot from buying again within the set amount of milliseconds after a buy order has been placed.
timeout_sell60000Values: numerical – represent time in milliseconds.
This is an internal timeout that prevents the bot from selling again within the set amount of milliseconds after a sell order has been placed.
VERBOSEtrueValues: true or false.
Setting this to true will lead to more detailed information being shown in the console.
WATCH_MODEfalseValues: true or false.
When set to true, Gunbot will process the configured pairs, but will not place actual buy or sell orders. Good for testing.
json_output./jsonValues: string – represents a path.
The path to save JSON state files for pairs.
withdraw_addressSet a valid BTC wallet address to enable automatic withdraws each time the threshold is reached.
withdraw_threshold0.5Values: numerical – represents an amount of BTC.
Set the amount of BTC to be accumulated with RESERVE_PILE_UP before an automatic withdraw will be executed.

Telegram settings (part of bot section)

When you want Gunbot to send Telegram notifications of every trade placed, this is where you set that up.

Steps needed:

  1. Talk to @botfather. Create a new bot with the command /newbot and choose a name and username for your bot. Save the bot token shown
  2. Talk to @myidbot to see your Chat ID, save it.
  3. Enable Telegram notifications for Gunbot, and enter the token and ID you’ve just gathered.
  4. Start a chat with the username you’ve picked for your bot, and hit the start button.
ParameterDefault ValueDescription
TELEGRAM_ENABLEDfalseValues: true or false.
Enable this to have Gunbot send notifications through Telegram of every trade it makes.
TELEGRAM_NICKGunbotValues: string.
Each trade notification starts with the nickname set here. Use this to easily check from which bot instance the notifications have been sent.
TOKENYOURTOKENValues: string.
The Telegram token for your bot.
chat_id“123456789”Values: string.
The Chat ID for your bot to send its messages to.Valid options:
“12345”
A positive integer, to send messages directly to a telegram user. Use this method when you just want to receive notifications for your personal use.To find your telegram id, send /start to @MyTelegramID_bot and it will respond with your ID.

“-12345”
A negative integer, to send messages to a group chat.The easiest way to obtain a groups id, is to open https://web.telegram.org login, and navigate to the group. Now pay attention to the URL, you should see something like https://web.telegram.org/#/im?p=g12345 – the number after the p=g part is the group id.
This must be listed in chat_id with a – symbol in front, in this case “-12345”
TG_PL_ONLYfalseValues: true or false.
Optional parameter. When enabled notifications will be only sent for strategy sell orders.
TG_ORDER_TIMEOUT0Values: numerical, represent time in seconds.
When set above 0, you’ll receive a Telegram dialog to manually allow or deny every order Gunbot wants to place. During the set amount of seconds you can choose to allow the order (and it will immediately be placed) or deny it. After the timeout passes without reply, the order will be placed at the exchange.
TG_TESTfalseValues: true or false.
Enable this to test if your Telegram bot is working. A test message will be sent on the first round for each pair. Disable after verifying your bot works.

Autoconfig settings (part of bot section)

Detailed settings descriptions for Autoconfig are available on a dedicated page.

GUI settings

Settings related to the Gunbot GUI.

ParameterDefault ValueDescription
enabledtrueSet this to false to disable the GUI.
startfalseWhen set to false, Gunbot starts the GUI but does not process pairs until the core is started from the GUI. In case you don’t want to use the GUI, set this to true.
port5000The port number for the GUI.
httpsfalseSet this to true to run the GUI via https only. This requires that you generate a key pair and save these in your Gunbot folder.
keylocalhost.keyDefines the filename of your private key used for running the GUI via https.
certlocalhost.certDefines the filename of your certificate used for running the GUI via https.
networktrafficfalseSet this to true to show GUI network traffic requests in Gunbot logs. Can be usefull for debug purposes.
logintrueSet this to true to enable password authentication. The password is setup using the GUI. In case you need to reset your password, set this to false.
twoFAfalseSet this to true to enable two factor authentication. This is setup using the GUI. In case you need to reset 2FA, set this to false.
tradetrueSet this to true to receive trade notications in the GUI.
callbackfalseSet this to true to receive callback notications in the GUI.
errortrueSet this to true to receive error notications in the GUI.

Tradingview settings (part of bot section)

Detailed settings descriptions for the Tradingview add-on are available on a dedicated page.

IMAP listener settings (for Tradingview plugin)

Detailed settings descriptions for the Tradingview add-on IMAP listener available on a dedicated page.

WebSockets settings (ws)

These settings are used to setup the port number and hostname for WebSockets emitted by Gunbot.

It is recommended to use the default values unless you know what you are doing.

ParameterDefault valueDescription
port5001You can change the port for WebSockets here.
clientport3000You can change the client port for third party web interfaces here.
hostname127.0.0.1The IP address or hostname to be used for WebSockets. Defaults to your localhost. An external IP can also be set.