Skip to main content

AutoConfig trading examples

Discover simple automations with AutoConfig using the examples below. Of course this is not an exhaustive list, it's just a quick overview to show you some of the options you can work with.

Top volume pairs

This example manages the addition and removal of top volume BTC pairs on Binance while excluding low sat pairs and those with a bid/ask spread higher than 0.4%. It limits the number of active pairs to ten using the addPairs function. Any pairs that no longer meet the criteria after an hour are automatically removed. However, pairs with a balance worth more than the "min volume to sell" are not removed.

{
"add-pairs": {
"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-preferred-strategy",
"resume": true,
"enabled": true
},
"remove-pairs": {
"pairs": {
"exclude": "",
"noBag": true,
"removeDisabled": true,
"exchange": "binance",
"notRemoveBefore": 60
},
"filters": {
"volume rank": {
"type": "minVolumeRank",
"min": 11
},
"spread": {
"type": "minSpreadPct",
"max": 0.4
}
},
"schedule": "*/15 * * * *",
"type": "removePairs",
"enabled": true,
"resume": true,
}
}

This example manages the addition and removal of trending BTC and USD pairs on Binance while avoiding crossover problems like trading both USDT-BTC and BTC-ETH. It also excludes low sat pairs and those with a bid/ask spread higher than 0.4%. The example employs ticker data filters to determine recent pair behavior. The addPairs function limits the number of active pairs to ten, and any pairs that no longer meet the criteria are automatically removed after an hour. However, pairs with a balance worth more than the "min volume to sell" are not removed.

{
"Add uptrending pairs - BTC": {
"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",
"min": 0.6
}
},
"schedule": "1,6,11,16,21,26,31,36,41,46,51,56 * * * *",
"type": "addPairs",
"strategy": "your-preferred-strategy",
"snapshots": 144,
"debug": false,
"setITB": true,
"resume": true,
"enabled": true
},
"Add uptrending pairs - USDT": {
"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",
"min": 0.6
}
},
"schedule": "3,8,13,18,23,28,33,38,43,48,53,58 * * * *",
"type": "addPairs",
"strategy": "your-preffered-strategy",
"snapshots": 144,
"setITB": true,
"resume": true,
"enabled": true
},
"remove-pairs": {
"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,
}
}

Dynamic gain target

This example sets the gain target to 2 when EMA 1 is higher than EMA 2 and 1 when EMA 1 is lower than EMA 2. A custom filter always passes because this job does not require any filter conditions.

{
"dynamic-gain": {
"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",
"enabled": true
}
}

Custom code integration

This example showcases the use of custom code in various parts of the job. You can use a javascript minifier to convert the readable code into a format required by AutoConfig.

{
"Dynamic-bounds": {
"pairs": {
"exclude": "",
"include": "-",
"exchange": "binance"
},
"filters": {
"Check for needed data": {
"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)"
},
"Follow 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",
"enabled": true
}
}