Gunbot's AutoConfig feature allows you to automate tasks across various cryptocurrency exchanges. To ensure an AutoConfig job targets the correct market, you must specify the desired exchange using the exchange
parameter. This setting is crucial as it dictates where AutoConfig will fetch data from, which pairs it will consider, and ultimately, where any configuration changes or trading actions (if applicable to the job type) will be directed.
Nearly every option that follows can be set without editing files by hand.
Click the โฎ (three-dots) menu โ AutoConfig, step through the wizard, and press Save; it will write a correct autoconfig.json
for you.
The Role of the exchange
Parameterโ
When you set up an AutoConfig job, you're essentially giving Gunbot a set of instructions to perform tasks like scanning for trading pairs, collecting data, or modifying strategy settings. The exchange
parameter tells AutoConfig where to perform these tasks. Each cryptocurrency exchange (like Binance, Kraken, Bitget, etc.) has its own unique set of trading pairs, API endpoints, and market characteristics.
The exchange
parameter is a string value that must match one of the exchange identifiers recognized by Gunbot. This identifier is usually the lowercase name of the exchange as it appears in your main Gunbot config.js
file (e.g., "binance", "kraken", "kucoin").
Locating and Setting the exchange
Parameterโ
The exchange
parameter is found within the pairs
object of an AutoConfig job's JSON definition. The pairs
object itself groups settings related to how AutoConfig should handle trading pairs for that specific job.
Here's an illustrative example:
{
"dataCollectorJob": {
"enabled": true,
"schedule": "*/15 * * * *", // Runs every 15 minutes
"type": "collectData",
"snapshots": 500,
"pairs": {
"exchange": "kraken", // User setting: Specifies the target exchange
"include": "USD-,EUR-", // Example: Include all USD and EUR pairs
"exclude": "USD-BTC" // Example: Exclude USD-BTC
}
// ... other job settings
}
}
In the "dataCollectorJob" example:
"exchange": "kraken"
clearly instructs this AutoConfig job to connect to and interact with the Kraken exchange.- Consequently, the
include
andexclude
strings underpairs
will be interpreted in the context of Kraken's available trading pairs. For instance, AutoConfig will look for pairs beginning with "USD- or "EUR-" on Kraken and will specifically exclude "USD-BTC" on Kraken (if it matched the include).
If this job were of type addPairs
or manageOverrides
, any pairs added or modified would be within the Kraken section of your main Gunbot configuration.
Importance of Correct Exchange Specificationโ
Setting the exchange
parameter accurately is vital for several reasons:
- Correct Market Data: AutoConfig will fetch ticker data (prices, volumes, etc.) from the specified exchange. If the exchange is wrong, the data will be irrelevant to your intended operations.
- Valid Pair Scoping: The
include
,exclude
,filteredQuote
,filteredBase
, andfilteredPair
settings within thepairs
object are all relative to the specifiedexchange
. Pair naming conventions can differ (e.g., "BTC/USDT" vs. "BTC-USDT" vs. "XBTUSDT"). Using "binance" as the exchange tells AutoConfig to look for Binance's pair formats and available assets. - API Interaction: Gunbot uses exchange-specific API connectors. The
exchange
setting ensures the correct connector and API credentials (from your mainconfig.js
) are used. - Configuration Integrity: For job types like
addPairs
ormanageOverrides
, changes are written to the corresponding exchange section in your Gunbotconfig.js
. An incorrectexchange
setting could lead to pairs being added to the wrong exchange block or overrides being applied mistakenly. - Filter Logic: Some filters might behave differently or require different threshold values depending on the typical market conditions of an exchange (e.g., average trading volumes, price tick sizes).
Working with Multiple Exchangesโ
You can, and often will, have multiple AutoConfig jobs, each potentially targeting a different exchange. This is a common scenario for traders who operate on several markets.
{
"binanceSpotScanner": {
"type": "addPairs",
"pairs": {
"exchange": "binance", // Targets Binance
"include": "USDT-"
}
// ... other settings for Binance job
},
"kucoinFuturesScanner": {
"type": "addPairs",
"pairs": {
"exchange": "kucoinfutures", // Targets KuCoin Futures
"include": "-PERP"
}
// ... other settings for KuCoin Futures job
}
}
In this setup, "binanceSpotScanner" would exclusively work with Binance spot markets, while "kucoinFuturesScanner" would focus on KuCoin Futures. Each job operates independently based on its exchange
setting.
Exchange Naming Conventionsโ
Ensure the string value you provide for the exchange
parameter matches the exact identifier Gunbot uses for that exchange. These are typically found as the top-level keys within the exchanges
object in your main config.js
file. Examples include:
binance
kraken
bitget
kucoin
okx
binancefutures
(for Binance Futures)
Using an incorrect or misspelled exchange name will prevent the AutoConfig job from functioning correctly and will likely result in errors reported in the Gunbot logs.
Using this.exchangeName
in Custom Scriptsโ
If you are writing custom JavaScript filters within AutoConfig, the this.exchangeName
context variable will be available and will hold the value of the exchange
parameter for the currently executing job.
// Conceptual example in a custom AutoConfig filter script
// const currentJobExchange = this.exchangeName; // Will be 'kraken' if the job targets Kraken
// if (currentJobExchange === 'binance') {
// // Apply logic specific to Binance
// } else if (currentJobExchange === 'kraken') {
// // Apply logic specific to Kraken
// }
This allows you to write more flexible custom filters that can adapt their behavior based on the exchange the job is running against, although typically, an AutoConfig job is tailored for one specific exchange via its configuration.
By correctly setting the exchange
parameter within the pairs
object, you provide essential direction to your AutoConfig jobs, ensuring they operate on the intended cryptocurrency exchange and interact with the correct market data and configuration sections. Always double-check this setting to prevent errors and ensure your automation tasks are executed as planned.