Skip to main content

AutoConfig Examples

To get started quickly with Gunbot's AutoConfig, use the examples on this page to see how to implement common trading automations.

Info

These examples provide templates for common AutoConfig use cases. You'll typically need to adjust parameters like YOUR_STRATEGY, exchange names, and specific filter values to suit your trading setup. Remember that all jobs for an exchange are stored in the autoconfig.json file.

Add Top Volume Pairs​

This example demonstrates how to automatically manage the addition and removal of top-volume BTC pairs on Binance, excluding low-satoshi pairs and those with a bid/ask spread higher than 0.4%.

The addPairs job limits the number of active pairs to ten. Pairs that no longer meet the specified criteria (e.g., volume rank drops or spread increases above 0.4%) are removed automatically by the removePairs job after being in the configuration for over an hour. Pairs with a balance worth more than MIN_VOLUME_TO_SELL are not removed by the removePairs job due to noBag: true.

{
"addPairs": {
"pairs": {
"exclude": "",
"include": "BTC-",
"maxPairs": 10,
"exchange": "binance"
},
"filters": {
"price": {
"type": "minPrice",
"min": 0.000001
},
"volume rank": {
"type": "maxVolumeRank",
"max": 11
},
"spread": {
"type": "maxSpreadPct",
"max": 0.4
}
},
"schedule": "*/5 * * * *",
"type": "addPairs",
"strategy": "YOUR_STRATEGY",
"debug": false,
"resume": true,
"enabled": true
},
"removePairs": {
"pairs": {
"exclude": "",
"noBag": true,
"removeDisabled": true,
"exchange": "binance",
"notRemoveBefore": 60
},
"filters": {
"volume rank": {
"type": "minVolumeRank",
"min": 11
},
"spread": {
"type": "minSpreadPct",
"min": 0.4
}
},
"schedule": "*/15 * * * *",
"type": "removePairs",
"enabled": true,
"resume": true,
"debug": true
}
}

Add Uptrending BTC and USDT Pairs​

This example demonstrates automatic management of trending BTC and USDT pairs on Binance, excluding low-satoshi pairs (for BTC) and those with a bid/ask spread higher than 0.6% (as per filter example). It also prevents crossover problems, such as trading both USDT-BTC and BTC-ETH simultaneously, using noCrossover: true.

This example makes extensive use of ticker data filters to determine the pair's recent behavior.

Each addPairs job in this example limits its respective pair list (BTC or USDT) to ten active pairs. Pairs that no longer meet the criteria after being in the configuration for over an hour are removed automatically by the "Remove pairs after 1h" job. Pairs with a balance worth more than MIN_VOLUME_TO_SELL are not removed.

{
"Add uptrending BTC pairs": {
"pairs": {
"exclude": "USDT-BTC",
"include": "BTC-",
"maxPairs": 10,
"noCrossover": true,
"exchange": "binance"
},
"filters": {
"filter1": {
"type": "minPrice",
"min": 0.000001
},
"filter2": {
"type": "minVolume24h",
"min": 150
},
"filter3": {
"type": "minVolatilityPct24h",
"min": 2.5
},
"filter4": {
"type": "maxVolatilityPct24h",
"max": 10
},
"filter5": {
"type": "minSlopePctInterval",
"min": 0.0075
},
"filter6": {
"type": "maxSlopePctInterval",
"max": 0.05
},
"filter7": {
"type": "minPricePctChangeInterval",
"min": 0.5
},
"filter8": {
"type": "maxPricePctChangeInterval",
"max": 5
},
"filter9": {
"type": "maxSpreadPct",
"max": 0.6
}
},
"schedule": "1,6,11,16,21,26,31,36,41,46,51,56 * * * *",
"type": "addPairs",
"strategy": "YOUR_BTC_STRATEGY",
"snapshots": 144,
"debug": false,
"setITB": true,
"resume": true,
"enabled": true
},
"Add uptrending USDT pairs": {
"pairs": {
"exclude": "USDT-BTC",
"include": "USDT-",
"maxPairs": 10,
"noCrossover": true,
"exchange": "binance"
},
"filters": {
"filter2": {
"type": "minVolume24h",
"min": 300000
},
"filter3": {
"type": "minVolatilityPct24h",
"min": 2.5
},
"filter4": {
"type": "maxVolatilityPct24h",
"max": 10
},
"filter5": {
"type": "minSlopePctInterval",
"min": 0.0075
},
"filter6": {
"type": "maxSlopePctInterval",
"max": 0.05
},
"filter7": {
"type": "minPricePctChangeInterval",
"min": 0.5
},
"filter8": {
"type": "maxPricePctChangeInterval",
"max": 5
},
"filter9": {
"type": "maxSpreadPct",
"max": 0.6
}
},
"schedule": "3,8,13,18,23,28,33,38,43,48,53,58 * * * *",
"type": "addPairs",
"strategy": "YOUR_USDT_STRATEGY",
"snapshots": 144,
"debug": false,
"setITB": true,
"resume": true,
"enabled": true
},
"Remove pairs after 1h": {
"pairs": {
"exclude": "",
"noBag": true,
"removeDisabled": true,
"exchange": "binance",
"notRemoveBefore": 60
},
"filters": {
"filter10": {
"type": "minPrice",
"min": 0.00000000001
}
},
"schedule": "*/15 * * * *",
"type": "removePairs",
"snapshots": 1,
"enabled": true,
"debug": false
}
}

Dynamic Gain Target​

This example dynamically sets the GAIN override to 2 if ema1 is greater than ema2 for a pair, and to 1 if ema1 is less than or equal to ema2. The custom filter always passes; it is included because this job does not require any other specific filter conditions for pair selection but needs at least one filter to process pairs for override changes.

{
"dynamicGainTarget": {
"pairs": {
"exclude": "",
"include": "-",
"exchange": "binance"
},
"filters": {
"alwaysPasses": {
"type": "custom",
"target": " true"
}
},
"overrides": {
"GAIN": " this.pair.ema1 > this.pair.ema2 ? 2 : 1"
},
"clearOverrides": false,
"schedule": "* * * * *",
"type": "manageOverrides",
"debug": true,
"enabled": true
}
}

Custom Code Example​

This example illustrates how custom JavaScript code can be used in various parts of an AutoConfig job. Use a JavaScript minifier to convert your readable code into the single-line minified code required for AutoConfig JSON string values.

{
"moveBounds": {
"pairs": {
"exclude": "",
"include": "-",
"exchange": "binance"
},
"filters": {
"Sanity checks": {
"type": "custom",
"target": " (function CheckDataExists(data){if(typeof data.pair.whatstrat==='undefined'){return false;} if(typeof data.pair.ABP==='undefined'){return false;} if(typeof data.pair.candlesclose==='undefined'){return false;} if(typeof data.pair.candlesopen==='undefined'){return false;} if(typeof data.pair.Ask==='undefined'){return false;} if(typeof data.pair.Bid==='undefined'){return false;} if(typeof data.pair.quoteBalance==='undefined'){return false;}else{return true;}})(this)"
},
"Price movement": {
"type": "custom",
"target": " (function trackMovement(data){const upperboundThresholdPct=5;const lowerboundThresholdPct=10;if(typeof data.pairVariables==='undefined'){return!0}else if(typeof data.pairVariables.binance==='undefined'){return!0}else if(typeof data.pairVariables.binance[data.pairName]==='undefined'){return!0}else if(typeof data.pairVariables.binance[data.pairName].referencePrice!=='number'){return!0};const upperbound=parseFloat(data.pair?.whatstrat?.UPPER_BOUND);const lowerbound=parseFloat(data.pair?.whatstrat?.LOWER_BOUND);if(data.pair.Bid>upperbound*(1-(upperboundThresholdPct/100))||data.pair.Bid>upperbound){return true} if(data.pair.Bid<lowerbound*(1+(lowerboundThresholdPct/100))||data.pair.Bid<lowerbound){return true}})(this)"
}
},
"setPairVariable": {
"referencePrice": " this.pair.Bid"
},
"overrides": {
"UPPER_BOUND": " this.pair.Bid > this.pairVariables['binance'][this.pairName].referencePrice ? this.pair.Bid * 1.5 : this.pair.Bid * 1.1",
"LOWER_BOUND": " this.pair.Bid > this.pairVariables['binance'][this.pairName].referencePrice ? this.pair.Bid * 0.9 : this.pair.Bid * 0.5"
},
"clearOverrides": false,
"schedule": "*/15 * * * * *",
"type": "manageOverrides",
"debug": true,
"enabled": true
}
}