When setting up complex AutoConfig jobs in Gunbot, especially those with multiple filters or custom JavaScript logic, it can sometimes be challenging to understand why a certain pair is passing or failing your conditions. AutoConfig provides a debug
mode parameter for each job, which, when enabled, outputs verbose logging about the filter evaluation process, greatly aiding in troubleshooting.
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 Purpose of debug
Modeโ
The debug
parameter in an AutoConfig job serves a single, crucial purpose: to provide verbose, step-by-step logging of the filter evaluation process for that job. When you're trying to understand:
- Why a specific pair is not being added by an
addPairs
job. - Why an override is not being applied by a
manageOverrides
job. - The intermediate values and logic flow within a
custom
JavaScript filter. - How different filter types are interpreting market data or variables.
Enabling debug: true
will give you much more insight than the standard operational logs.
How to Enable debug
Modeโ
The debug
parameter is a boolean (true
or false
) that you set at the top level of an individual AutoConfig job's definition in your autoconfig.json
file.
{
"pairFilterTest": {
"enabled": true,
"type": "addPairs", // Or any other job type that uses filters
"schedule": "*/5 * * * *",
"debug": true, // User setting: Enable verbose filter logging for this job
"pairs": {
"exchange": "binance",
"include": "USDT-BTC,USDT-ETH"
},
"filters": {
"volumeCheck": {
"filterType": "minVolume24h",
"minVol": 1000000
},
"spreadCheck": {
"filterType": "maxSpreadPct",
"maxSpread": 0.1
},
"customLogic": {
"filterType": "custom",
"script": " console.log('Custom filter for ' + this.pairName + ': Checking this.variables.myFlag: ' + this.variables.myFlag); return this.variables.myFlag === true && this.tickers[this.config.AutoConfig.pairFilterTest.jobName][this.tickers[this.config.AutoConfig.pairFilterTest.jobName].length-1][this.pairName].ask > 20000;"
}
},
"strategy": "spotgrid"
}
}
In the pairFilterTest
job:
"debug": true
will activate detailed logging for this job specifically. Other jobs in yourautoconfig.json
withoutdebug: true
will continue to log normally.
Interpreting debug
Mode Outputโ
When debug: true
is active for a job, as it processes pairs against its filters, you will see additional lines in your Gunbot console log (and usually persisted in gunbot_log.txt
and/or autoconfig-log.txt
). The exact format can vary slightly between Gunbot versions, but it typically includes:
- Pair being evaluated: The name of the trading pair currently under scrutiny.
- Filter rule being evaluated: The name of the specific filter rule from your job's configuration.
- Filter type: The
filterType
(e.g.,minVolume24h
,custom
,variableExact
). - Data values: The actual data values being used in the comparison. For instance, for
minVolume24h
, it might showPair USDT-BTC volume: 1234567, Filter threshold: 1000000
. - Result: Whether that specific filter rule passed (
true
) or failed (false
) for that pair. - Custom filter
console.log
: Anyconsole.log()
statements you've placed within acustom
filter's script will also appear in this output, which is extremely helpful for debugging JavaScript logic.
Example Log Snippets (Conceptual):
[INFO] AutoConfig: Job pairFilterTest - Evaluating pair USDT-BTC
[DEBUG] AutoConfig: Job pairFilterTest - Filter volumeCheck (minVolume24h) for USDT-BTC. Pair Volume: 1500000, Threshold: 1000000. Result: true
[DEBUG] AutoConfig: Job pairFilterTest - Filter spreadCheck (maxSpreadPct) for USDT-BTC. Pair Spread: 0.05, Threshold: 0.1. Result: true
[DEBUG] AutoConfig: Job pairFilterTest - Filter customLogic (custom) for USDT-BTC.
Custom filter for USDT-BTC: Checking this.variables.myFlag: true // Output from console.log in script
[DEBUG] AutoConfig: Job pairFilterTest - Filter customLogic (custom) for USDT-BTC. Script returned: true. Result: true
[INFO] AutoConfig: Job pairFilterTest - Pair USDT-BTC passed all filters.
...
[INFO] AutoConfig: Job pairFilterTest - Evaluating pair USDT-ETH
[DEBUG] AutoConfig: Job pairFilterTest - Filter volumeCheck (minVolume24h) for USDT-ETH. Pair Volume: 800000, Threshold: 1000000. Result: false
[INFO] AutoConfig: Job pairFilterTest - Pair USDT-ETH failed filterSet 1 at rule volumeCheck.
This detailed trace allows you to pinpoint exactly which filter rule is causing a pair to be included or excluded, and why.
When to Use debug
Modeโ
- Developing New Filters: When you first create a new AutoConfig job or add new filter rules, run it with
debug: true
on a limited set ofpairs.include
(maybe just one or two test pairs) to verify the logic immediately. - Unexpected Behavior: If an AutoConfig job isn't adding pairs you expect, or is adding pairs it shouldn't,
debug: true
is the first tool to use to investigate. - Troubleshooting Custom Scripts: For
custom
filters,debug: true
combined with your ownconsole.log()
statements within the script is essential for seeing variable values and logic flow. - Understanding Data Issues: If you suspect the market data (tickers, history) or variable data (
this.variables
,this.pairVariables
) is not what you expect, debug mode can help reveal the values AutoConfig is actually working with.
Important Considerationsโ
- Log Verbosity:
debug: true
generates a lot of log output, especially for jobs that run frequently or process many pairs. This is great for troubleshooting but can make your main Gunbot log very large and harder to read for other operational messages. - Disable After Use: Once you've resolved your filter issues, it's generally recommended to set
debug: false
for the job to keep your logs cleaner for routine monitoring. Only enable it when actively diagnosing a problem. - Performance: While the performance impact of debug logging is usually minor, for extremely high-frequency jobs processing thousands of potential pairs, constant debug logging could add a small overhead.
- Focus on One Job: If you have many AutoConfig jobs, enable
debug: true
only for the specific job you are currently troubleshooting to avoid being overwhelmed by log data.
The debug
mode is an indispensable diagnostic tool for any Gunbot user working with AutoConfig. It demystifies the filter evaluation process and provides the clarity needed to build reliable and effective automated trading and pair management rules. Remember to use it judiciously and turn it off once your troubleshooting is complete.