AutoConfig Job Types
Each job type serves a unique purpose. For instance, to add pairs, use the addPairs
job type. To modify settings for a running pair, use the manageOverrides
job type. It is important to select the appropriate job type based on the specific task you need to perform.
In AutoConfig, a "job" is a defined set of instructions and conditions that Gunbot executes on a schedule to automate specific trading tasks or configuration changes.
Gunbot's AutoConfig provides different job types that grant access to various trading data points. Some job types scan markets for data related to trading pairs that Gunbot is not currently processing. For this, they use ticker data. Other job types are for pairs already running in Gunbot. They use internally available data and do not consume additional API rate limits.
The addPairs
, removePairs2
, and manageOverrides
job types are the most commonly used. These job types enable you to create a comprehensive workflow for adding pairs, managing their settings, and ultimately removing them. In most cases, these job types will cover your automation needs.
Job Types Overview​
The table below lists the job types. If an AutoConfig job type requests ticker data from the exchange, it is marked as using external data. Conversely, if a job type uses internal data, it will execute faster and consume no API rate limit. Whenever possible, choose a job type that uses internal data for the task you want to automate to optimize performance and API usage.
Job Types by Data Source​
External Data | Internal Data |
---|---|
addPairs | changeDelay |
backtesting | changeStrategy2 |
changeStrategy | manageBotSettings |
collectData | manageOverrides |
manageOverrides2 | removePairs2 |
removePairs |
For job types that require external data, the following exchanges are supported:
alpaca
binance
binanceFutures
binanceus
bingx
bitget
bybit
cex
coinbase
cryptocom
dydx4
futures_gunthy
gateio
hitbtc
huobi
hyperliquid
kraken
kucoin
mex_gunthy
mexc
okex5
poloniex
Job Types by Primary Function​
Job Type | Primary Function |
---|---|
addPairs | Add trading pairs to a specific exchange. |
backtesting | Simulate an addPairs job using data collected with a collectData job. |
changeDelay | Change exchange delay. |
changeStrategy changeStrategy2 | Change assigned trading strategy for pairs. |
collectData | Collect ticker data for use in a backtesting job. |
manageBotSettings | Change Gunbot config.bot settings. |
manageOverrides manageOverrides2 | Change overrides for pairs. |
removePairs removePairs2 | Remove active trading pairs. |
Details Per Job Type​
Each job type has several obligatory parameters, described below. Additionally, optional parameters can extend a job's functionality.
Adding Pairs​
Type name in config: addPairs
This job type uses Ticker Filters.
Job output: Adds trading pairs to a specific exchange.
Pair options:
include
: Included pairs (processed first). Any pair on the exchange that matches any of the includes will be processed. If you also use theexclude
option, the resulting pairs after processing the includes is the starting point for processing excludes, which will remove items from this list of pairs. Enter as a comma-separated list; spaces between items are not accepted. This field cannot be empty. Included items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be included.exclude
: Excluded pairs (processed last). Any pair on the exchange that matches any of the excludes will not be processed. Enter as a comma-separated list; spaces between items are not accepted. This field can be empty. Excluded items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be excluded.maxPairs
: Maximum number of allowed pairs. If a filter action results in more pairs than this setting, the configuration will be filled up to the maximum number of allowed pairs. Only enabled pairs count towardsmaxPairs
.
Other Obligatory Parameters​
strategy
: This defines the strategy that will be assigned to pairs added by this job. It must be the exact name of an existing strategy in yourconfig.js
file.snapshots
: Defines how many ticker snapshots are saved to perform calculations on. Relevant for filter types that includeInterval
in their name. For example, ifsnapshots
is set to 10, the ticker data for the last 10 times the job ran are saved, and some of its values are used for calculating average values over time.
Config Example​
The example below shows a job that performs the following actions:
- Scan Binance tickers every minute.
- Automatically add BTC-x pairs (but not BTC-DOGE, which is excluded) that have a top 10 volume ranking and for which the bid/ask spread is below 0.2%.
- Added pairs get the "gain" strategy assigned.
- Allows for up to 25 active trading pairs on Binance.
{
"addTopVolumePairs": {
"pairs": {
"exclude": "DOGE",
"include": "BTC-",
"maxPairs": 25,
"exchange": "binance"
},
"filters": {
"filter1": {
"type": "maxVolumeRank",
"max": 11
},
"filter2": {
"type": "maxSpreadPct",
"max": 0.2
}
},
"schedule": "* * * * *",
"snapshots": 1,
"type": "addPairs",
"strategy": "gain"
}
}
Removing Pairs​
Type names in config: removePairs
(uses Ticker Filters) or removePairs2
(uses State Filters).
You must have at least one pair configured for each exchange where you use this job type.
Job output: Removes trading pairs from a specific exchange.
Pair options:
exclude
: Pairs that should not be scanned for possible removal. Any active pair that matches any of the excludes will not be processed. Enter as a comma-separated list; spaces between items are not accepted. This field can be empty. Excluded items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be excluded. There are no include options for this filter type. Pairs in your configuration (that have already cycled in Gunbot) are effectively the list of includes.noBag
(true
/false
): Whentrue
, only pairs with a balance belowMIN_VOLUME_TO_SELL
that have no open orders and are not in reversal trading are filtered for possible removal. When set tofalse
, all pairs in the configuration are filtered.removeDisabled
(true
/false
): Whentrue
, each time aremovePairs
job is run, it will remove all disabled pairs for the exchange the job runs on, regardless of filter settings. Useful, for example, when you useCOUNT_SELL
.
Other Obligatory Parameters​
snapshots
: Defines how many ticker snapshots are saved to perform calculations on. Relevant for filter types that includeInterval
in their name. For example, ifsnapshots
is set to 10, the ticker data for the last 10 times the job ran are saved, and some of its values are used for calculating average values over time.
Config Example​
The example below shows a job that performs the following actions:
- Scan Binance tickers every ten minutes.
- Remove any pair that has a volume ranking below 20, besides pairs containing BNB or XVG in their name.
- Additionally, remove all disabled pairs from the configuration.
{
"removeCrap": {
"pairs": {
"exclude": "BNB,XVG",
"noBag": false,
"removeDisabled": true,
"exchange": "binance"
},
"filters": {
"filter1": {
"type": "minVolumeRank",
"min": 20
}
},
"schedule": "*/10 * * * *",
"snapshots": 1,
"type": "removePairs"
}
}
Change Strategy​
Type names in config: changeStrategy
(uses Ticker Filters) or changeStrategy2
(uses State Filters).
This job type is functionally similar to how removePairs
works, but this one changes a pair's strategy instead of removing the pair.
You must have at least one pair configured for each exchange where you use this job type.
Job output: Changes the assigned trading strategy for pairs on one exchange.
Pair options:
exclude
: Pairs that should not be scanned for possible strategy change. Any active pair that matches any of the excludes will not be processed. Enter as a comma-separated list; spaces between items are not accepted. This field can be empty. Excluded items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be excluded. There are no include options for this filter type. Pairs in your configuration (that have already cycled in Gunbot) are effectively the list of includes.bag
(true
/false
): Whentrue
, only pairs with a balance belowMIN_VOLUME_TO_SELL
that have no open orders and are not in reversal trading are filtered for possible strategy change. When set tofalse
, all pairs in the configuration are filtered.
Other obligatory parameters:
strategy
: The target strategy to set for pairs matching all filters.snapshots
: Defines how many ticker snapshots are saved to perform calculations on. Relevant for filter types that includeInterval
in their name. For example, ifsnapshots
is set to 10, the ticker data for the last 10 times the job ran are saved, and some of its values are used for calculating average values over time.
Config Example​
The example below shows a job that performs the following actions:
- Scan Binance tickers every 15 minutes.
- Change the assigned strategy for any pair that has below median trading volume, except BTC-LTC.
- Assign the strategy "baghandler" to these pairs.
{
"changeStrat": {
"pairs": {
"exclude": "BNB-LTC",
"bag": true,
"exchange": "binance"
},
"filters": {
"filter1": {
"type": "belowMedianVolume"
}
},
"schedule": "*/15 * * * *",
"snapshots": 1,
"type": "changeStrategy",
"strategy": "baghandler"
}
}
Managing Overrides​
Type name in config: manageOverrides
This job type uses State Filters.
Job output: Changes overrides for pairs on a specific exchange.
Pair options:
include
: Included pairs (processed first). Any active trading pair that matches any of the includes will be processed. If you also use theexclude
option, the resulting pairs after processing the includes is the starting point for processing excludes, which will remove items from this list of pairs. Enter as a comma-separated list; spaces between items are not accepted. This field cannot be empty. Included items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be included.exclude
: Excluded pairs (processed last). Any active trading pair that matches any of the excludes will not be processed. Enter as a comma-separated list; spaces between items are not accepted. This field can be empty. Excluded items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be excluded.
Other obligatory parameters:
overrides
: Contains zero or more overrides; these will be set for each pair that passes all filters when a job is executed.clearOverrides
(true
/false
): When set totrue
, all existing overrides for a pair are removed before the new ones are placed.
Config Example​
The example below shows a job that performs the following actions:
- Scan Binance pairs every minute, process filters on all active trading pairs that include "USDT" or "BNB" and do not include "DOGE" or "ETH" in their pair name.
- Set a
DU_BUYDOWN
override for all pairs that haveducount
of 1.
{
"DynamicDU1": {
"pairs": {
"exclude": "DOGE,ETH",
"include": "USDT,BNB",
"exchange": "binance"
},
"filters": {
"ducount": {
"type": "exact",
"ducount": 1
}
},
"overrides": {
"DU_BUYDOWN": 3
},
"clearOverrides": false,
"schedule": "* * * * *",
"type": "manageOverrides"
}
}
Change Exchange Delay​
Type name in config: changeDelay
This job type uses State Filters.
Job output: Changes the exchange delay for a specific exchange.
Pair options:
include
: Included pairs (processed first). Any active trading pair that matches any of the includes will be processed. If you also use theexclude
option, the resulting pairs after processing the includes is the starting point for processing excludes, which will remove items from this list of pairs. Enter as a comma-separated list; spaces between items are not accepted. This field cannot be empty. Included items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be included.exclude
: Excluded pairs (processed last). Any active trading pair that matches any of the excludes will not be processed. Enter as a comma-separated list; spaces between items are not accepted. This field can be empty. Excluded items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be excluded.
Other obligatory parameters:
delay
: Exchange delay in seconds; this value will be set if one or more pairs in the job pass all filters.
Config Example​
The example below shows a job that performs the following actions:
- Scan Binance pairs every minute, process filters on all active trading pairs that include "USDT" or "BNB" and do not include "DOGE" or "ETH" in their pair name.
- Set the exchange delay for Binance to 10 if at least one pair matches the filter.
{
"DynamicDU1": {
"pairs": {
"exclude": "DOGE,ETH",
"include": "USDT,BNB",
"exchange": "binance"
},
"filters": {
"ducount": {
"type": "exact",
"ducount": 1
}
},
"delay": 10,
"schedule": "* * * * *",
"type": "changeDelay"
}
}
Manage Bot Settings​
Type name in config: manageBotSettings
(uses State Filters).
This job type is functionally similar to how changeStrategy
works, but this type can change global bot settings.
You must have at least one pair configured for each exchange where you use this job type.
Job output: Changes assigned parameters in the bot
section of the configuration. This happens if at least one pair passes all filters.
Pair options:
exclude
: Pairs that should not be filtered. Any active pair that matches any of the excludes will not be processed. Enter as a comma-separated list; spaces between items are not accepted. This field can be empty. Excluded items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be excluded. There are no include options for this filter type. Pairs in your configuration (that have already cycled in Gunbot) are effectively the list of includes.
Other obligatory parameters:
bot
: The target bot settings.
Config Example​
{
"botsettings": {
"pairs": {
"exclude": "",
"exchange": "binance"
},
"filters": {
"price": {
"type": "biggerThan",
"Ask": 0.00000001
}
},
"bot": {
"BOT_DELAY": 20,
"BOT_CCLEAN": 9991
},
"schedule": "* * * * *",
"type": "manageBotSettings"
}
}
Hedge (for Gunbot)​
Type names in config: hedgeGB
(uses Ticker Filters) or hedgeGB2
(uses State Filters).
You must have at least one pair configured for each exchange where you use this job type.
Job output:
You can define a "hedge pair," like USDT-BTC, between which Gunbot should hedge when market conditions are favorable. If you prefer hedging between completely different currencies, like BTC-ETH, you can do that too.
It works with two AutoConfig jobs in which you define when it should hedge and to which currency it should hedge.
- If a pair can be hedged without an intermediate pair, AutoConfig will change a pair like BTC-ETH to USDT-ETH and panic sell directly to ETH.
- If an intermediate pair is needed, the pair will be panic sold first and then traded on the defined hedge pair.
Pair options:
Pair filtering is hardcoded to the defined hedge pair.
exclude
: Used as placeholder.bag
: Used as placeholder.baseFrom
: Base currency to hedge away from.baseTo
: Base currency to hedge to.hedgePair
: Pair used for hedging, like USDT-BTC.
Other obligatory parameters:
setVariable
: Hedging will only work if both hedging jobs set a variable with the currency it last hedged to; this ensures that the direction can be tracked for the next hedging action.
Config Example​
You will need two jobs to do this, one for each hedging direction:
{
"hedging": {
"pairs": {
"exclude": "",
"exchange": "binance",
"bag": false,
"baseFrom": "BTC",
"baseTo": "USDT",
"hedgePair": "USDT-BTC"
},
"filters": {
"filter1": {
"type": "yourTickerFilter",
"min": "0.0000000001"
},
"filter2": {
"type": "variableNotExist",
"hegdedTo": "BTC"
}
},
"filters2": {
"filter1": {
"type": "yourTickerFilter",
"min": "0.0000000001"
},
"filter2": {
"type": "variableExact",
"hegdedTo": "BTC"
}
},
"setVariable": {
"hegdedTo": "USDT"
},
"strategy": "gain",
"schedule": "1 */4 * * *",
"type": "hedgeGB",
"debug": false
}
}
The second job would be a mirror job, with all hedge currencies reversed.
Two important notes:
- Keep the hedge pair in your configuration at all times, preferably with buy/sell disabled to avoid crossover between base/quote.
- Set the filter for
"type": "variableNotExist"
ONLY in the job that will take care of the next hedging action. For example, when you start out with BTC-x pairs only, add this filter to the job that hedges to USDT.
Hedge (for bitRage)​
Type name in config: hedge
This job type uses State Filters.
Job output: Initiates hedging in bitRage.
Pair options:
include
: Included pairs (processed first). Any active trading pair that matches any of the includes will be processed. If you also use theexclude
option, the resulting pairs after processing the includes is the starting point for processing excludes, which will remove items from this list of pairs. Enter as a comma-separated list; spaces between items are not accepted. This field cannot be empty. Included items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be included.exclude
: Excluded pairs (processed last). Any active trading pair that matches any of the excludes will not be processed. Enter as a comma-separated list; spaces between items are not accepted. This field can be empty. Excluded items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be excluded.
Other obligatory parameters:
hedgeTo
(USDT
/BTC
): Defines which currency to start hedging to.brStrat
: Defines which strategy is used for bitRage.
Config Example​
The example below shows a job that performs the following actions:
- Scan for a user variable every minute.
- Once this variable is found, it places
filteredBase
,filteredQuote
, andfilteredPair
blocks as defined in the job for KuCoin (this part is optional). - Once this variable is found, it makes the following changes in the strategy
bitrageStrat
; it sets/changes the following parameters so that hedging will start:
"AUTOSELL": true,
"MAIN_BASE": "USDT",
"BR_PANIC_SELL": true,
{
"Hedge_to_USDT": {
"pairs": {
"exclude": "",
"include": "",
"exchange": "kucoin",
"filteredBase": [
"TUSD",
"PAX",
"KCS",
"NUSD",
"ETH",
"DAI",
"USDC",
"TRX",
"NEO",
"BTC"
],
"filteredQuote": [
"GGC"
],
"filteredPair": [
"BTC-GGC",
"USDT-GGC",
"BTC-KCS",
"USDT-KCS",
"KCS-XRP",
"KCS-EOS",
"KCS-LTC",
"KCS-NEO",
"KCS-MTV",
"KCS-GO",
"KCS-CS",
"ETH-KCS",
"NEO-EOS",
"DAI-BTC",
"DAI-ETH",
"DAI-MKR",
"DAI-USDT"
]
},
"filters": {
"variable": {
"type": "variableExact",
"readyToHedge": "USDT"
}
},
"setVariable": {
"hedgingStarted": true
},
"schedule": "* * * * *",
"type": "hedge",
"hedgeTo": "USDT",
"brStrat": "bitrageStrat"
}
}
Filtered Quote (for bitRage)​
Type name in config: filteredQuote
This job type uses Ticker Filters.
Job output: It adds the quote currency of each pair passing all filters to the filteredQuote
list. Each time the job runs, the list is completely replaced with the new results.
Pair options:
include
: Included pairs (processed first). Any pair on the exchange that matches any of the includes will be processed. If you also use theexclude
option, the resulting pairs after processing the includes is the starting point for processing excludes, which will remove items from this list of pairs. Enter as a comma-separated list; spaces between items are not accepted. This field cannot be empty. Included items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be included.exclude
: Excluded pairs (processed last). Any pair on the exchange that matches any of the excludes will not be processed. Enter as a comma-separated list; spaces between items are not accepted. This field can be empty. Excluded items do not need to be whole pair names; as long as part of the string matches an actual pair, it will be excluded.
Config Example​
The example below would perform the following actions:
- Scan all Binance BTC-x pairs.
- Find pairs with a bid/ask spread higher than 0.7%.
- Save the quote currencies from these pairs in the
filteredQuote
list.
{
"filteredQuote": {
"pairs": {
"include": "BTC-",
"exclude": "",
"exchange": "binance"
},
"filters": {
"spread": {
"type": "minSpreadPct",
"min": 0.7
}
},
"schedule": "* * * * *",
"type": "filteredQuote",
"debug": false
}
}
Optional Parameters​
Optional Parameter | Possible Values | Job Type(s) | Description |
---|---|---|---|
enabled | true /false | All job types | When false , the job is disabled and will not be executed. |
debug | true /false | All job types | When true , the job generates detailed logs in the console for each filter. |
settings for user variables | - | All job types | Allows for the configuration of user-defined variables. |
brStrat | Strategy Name | All job types (specifically for bitRage) | Defines which strategy is used for bitRage. This is only needed if you use AutoConfig to automate hedging for bitRage. |
resume | true /false | Jobs using ticker filters | When true , saved ticker snapshots are loaded from the file after Gunbot restarts. When false , history needs to be built up again after restarting. |
history | Number | Jobs using ticker filters | Defines how many ticker history entries should be kept in storage. |
historyInterval | Number (minutes) | Jobs using ticker filters | Defines the minimum interval in minutes between history entries. |
setITB | true /false | addPairs and manageOverrides | When true , each pair matching all filters will get an additional IGNORE_TRADES_BEFORE override, with the value being the timestamp for when the job ran. For manageOverrides only. |
delay | Time in seconds | manageOverrides | When set, the exchange delay is adjusted to the specified value if at least one pair passes all filters. |
overrides | Object | addPairs | This job type can also add overrides when it adds new pairs. To do so, add an overrides section to the job, just as you would in a manageOverrides job. |
noCrossOver | true /false | addPairs (specifically for bitRage) | When set, AutoConfig will never add two pairs with different base currencies but the same quote currency. |
removeBase | Base Currency Code | removePairs | Can be used to remove all pairs from a specified base currency that use the bitRage strategy specified in brStrat . This is useful to clean out pairs from a specific base after hedging. |
notRemoveBefore | Value in minutes | removePairs | Do not remove pairs from the configuration if they have not been in the configuration longer than the specified duration. |
Bitrage filters | Object | hedge | When used for bitRage, you can have an addPairs job replace the contents of the exchange filter settings. To do so, add the filteredQuote , filteredPair , and filteredBase filters in the pairs section of the job. |
Backtesting for addPairs
Jobs​
Results for addPairs
jobs can be simulated using ticker data you have collected. Self-collection is necessary because the type of historical data AutoConfig uses is not publicly available.
Before you can backtest, you need to collect a dataset with a collectData
job. This is a simple AutoConfig job that collects and saves ticker data according to its schedule and the specified exchange.
{
"30-secs": {
"pairs": {
"exchange": "binance"
},
"schedule": "*/30 * * * * *",
"type": "collectData",
"snapshots": 1000,
"enabled": true,
"debug": false
}
}
The schedule in this collectData
job should be the same as the schedule you would use in an addPairs
job. It will collect ticker snapshots according to the snapshots
parameter and remove older snapshots if the limit is reached.
You can use any number of snapshots in this job type. If you omit the snapshots
parameter, it will collect ticker snapshots indefinitely, limited only by your system's available disk space.
Ticker data for this collection job is saved in a directory named after the job (e.g., /30-secs-tickers
if the job name is 30-secs
). Ensure you do not save any other files in this folder.
As long as the collectData
job runs, it continuously collects tickers. It is not recommended to permanently collect tickers while also running other AutoConfig jobs that use tickers: API rate limit consumption is relatively high, and it will slightly slow down Gunbot's performance.
To backtest using the collected data, run a job with type backtesting
. Do this while you have the Gunbot core and other AutoConfig jobs disabled, because backtesting is very CPU-intensive and you do not want other jobs to interrupt.
A backtesting
job is functionally the same as an addPairs
job; you can use all available filter and filter set options. Collected ticker data is replayed as if it were live data; the results should exactly match the results from a regular addPairs
job. Results are logged the same way as regular jobs, and the debug
option for jobs is also available. History
ticker snapshots can be used as well; these are built up in RAM while running through a backtest.
Results are saved to a .csv file that lists when pairs would have been added and what the ask price was at that moment.
Backtesting jobs also use the AutoConfig scheduler, although this is often bypassed for immediate execution. It is recommended to set an infrequent schedule and use the "onStart": true
option so that the job runs as soon as it is enabled.
Backtesting does not take maxPairs
into consideration (and will not in the future); results are purely based on the filters you use.
Job example for backtesting:
{
"30-secs": {
"pairs": {
"exclude": "",
"include": "BTC-",
"exchange": "binance"
},
"filters": {
"slope": {
"type": "minSlopePctInterval",
"min": 0.02
},
"volume": {
"type": "minVolume24h",
"min": 75
},
"pricehistory0": {
"type": "maxPricePctChangeIntervalHistory",
"max": 5,
"historySource": 9
}
},
"schedule": "1 1 1 1 1",
"type": "backtesting",
"tickersFolder": "30-secs-tickers",
"enabled": true,
"onStart": true,
"history": 10,
"historyInterval": 2,
"debug": false,
"snapshots": 10
}
}
The data source for backtesting is set with the "tickersFolder"
parameter. Set it to the exact folder name where your collected ticker files are located.
Various Notes​
- You can schedule multiple jobs for the same time, but if more than one job causes a configuration change, only the first to finish will apply its changes. The others must wait for another chance.
- Each job updates the
config.js
file, which always triggers a Gunbot restart. - If you need detailed console log output for your filters, you can add
"debug": true
to your job. However, use this option sparingly, as it can significantly slow down Gunbot's performance due to the large amount of data logged to the console. - AutoConfig may crash if you change the exchange for a ticker-filtering job while using
"resume": true
, or if you use a non-existent key in a state filter, among other potential issues. - Pair state data for filtering is available from either exchange tickers or internal Gunbot memory. You can find information about which pair state data to filter on in the pair state files located in the Gunbot
/json
folder. - If you do not want Telegram notifications for a specific job, include
"muteTG": true
in that job. - You can filter almost any key/value pair in pair state files as long as they are at the first level and not inside additional arrays or objects. Use a custom filter if you need to access nested values.