# Headless mode

{% hint style="info" %}
This article is meant for power users who want to run Gunbot without using the GUI.

This is not an exhaustive overview of all available settings, just a quick overview of how to manually work with the config file. Refer to other parts of the wiki for detailed settings descriptions.
{% endhint %}

## Config file system

All Gunbot settings are defined in a single file named `config.js`. This is where you set up your exchange API keys, add pairs and define your strategies.

You can refer to the included `config-js-example.txt` file for an example of a config file with properly defined pairs and all needed parameters for adding each exchange. Throughout this wiki you'll find detailed descriptions for every parameter available in the config file.

When the config file is overwritten while Gunbot is running, the changed settings will be loaded automatically.

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).

The only actions that requires using the GUI is updating master keys.

## Disabling the GUI

To disable the GUI completely, make the following change in the GUI section of `config.js`:

```
"GUI": {
        "enabled": false,
```

## Connecting exchanges

To connect an exchange, add the relevant settings to the exchange section of `config.js`.

It looks like this:

```
"binance": {
            "masterkey": "registered_api_key",
            "mastersecret": "secret_for_registered_api_key",
            "key": "trading_api_key",
            "secret": "secret_for_trading_api_key",
            "delay": 1,
            "type": "binance"
        },
```

Note that you can use a different API key for trading than the registered key. If you don't use a secondary key, you can just enter the registered key in the `key` parameter.

## Strategies

A strategy is defined by giving it a unique name and adding it to the `strategies` section of the config file. This strategy can then be assigned to one or more trading pairs.

It looks like this:

```
"custom-strategy": {
            "BUY_METHOD": "tssl",
            "BUY_ENABLED": true,
            "SELL_METHOD": "tssl",
            "SELL_ENABLED": true,
            "BUY_LEVEL": 1,
            "GAIN": 0.5,

(many lines cut out to keep this page clean)

            "SL_DISABLE_BUY": false,
            "COUNT_SELL": 9999,
            "TRADES_TIMEOUT": 0
        },
```

## Defining pairs and overrides

In the `pairs` section of the config file you can add one or more pairs inside a block specifying the exchange the pairs will run on.

Each pair must be assigned an existing strategy, it must be specified if the pair is enabled or not.

```
"Binance": {
            "BTC-LTC": {
                "strategy": "SMACROSS",
                "enabled": true,
                "override": {
                    "TRADING_LIMIT": 1000
                }
            }
        },
```

The override section allows for pair specific modifications to the assigned strategy. Any strategy parameter can be used as an override.

In the example above the pair will run the SMACROSS strategy, with a `TRADING_LIMIT` different from what is defined in the strategy itself.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gunthy.gitbook.io/wiki/setup-and-general-settings/installation/headless-mode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
