Skip to main content

Headless Mode

info

In this article, we focus on the power users of Gunbot who prefer running the bot without the GUI. It's a concise guide to working with the config file, touching upon key aspects without delving into exhaustive detail. For a comprehensive understanding of all settings, please refer to other sections of our docs. We recommend initially configuring Gunbot using the GUI for ease, and then, if desired, transitioning to a headless setup.

Introduction to the Config File System​

Gunbot operates with a central configuration file, config.js, which is the heart of your trading setup. Here, you'll input your exchange API keys, define trading pairs, and set up your strategies. For a jumpstart, consult the config-js-example.txt in your Gunbot package, illustrating a well-structured config file.

Remember, Gunbot dynamically adapts to changes in config.js even while running. However, be cautious with your edits: maintain the JSON format and avoid removing essential parameters. If you're ever in doubt, validate your config file at https://jsonlint.com or similar JSON validators. Note: Updating registered API keys is the sole task that necessitates the GUI.

Disabling the GUI​

If you decide to go headless, adjust the GUI settings in config.js as follows:

"GUI": {
"enabled": false,

Exchange Integration​

Linking Gunbot to your chosen exchange is straightforward. In config.js, add your exchange details under the exchange section. Example for Binance:

"binance": {
"masterkey": "your_registered_api_key",
"mastersecret": "your_api_secret",
... // Additional settings
},

Use different keys for registration and trading if needed. The masterkey and mastersecret are for your registered API key, while key and secret are for trading.

Setting Up Strategies​

Define a unique strategy by naming it and adding it to the strategies section of config.js. Assign this strategy to your trading pairs as needed. For instance:

"myStrategy": {
"BUY_METHOD": "gain",
"SELL_METHOD": "gain",
... // Other strategy settings
},

Pair Settings and Overrides​

Each trading pair, along with its assigned strategy and an optional override, is defined under the pairs section for its respective exchange. For example:

"binance": {
"BTC-ETH": {
"strategy": "myStrategy",
"enabled": true,
"override": {
"TRADING_LIMIT": 1000
}
},
... // Additional pairs
},

Overrides allow you to tweak strategy parameters on a per-pair basis.