Skip to main content

Use AutoConfig's 'exclude' parameter to blacklist pairs/patterns

While the pairs.include parameter in Gunbot's AutoConfig defines the initial watchlist for a job, the pairs.exclude parameter refines that list by blacklisting specific pairs or patterns. Pairs matching an exclude pattern are removed even if they matched an include pattern. This gives precise control over which pairs an AutoConfig job will process.

Use the AutoConfig wizard

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.

Refining Scope with pairs.exclude​

The pairs.exclude parameter works as a secondary filter after pairs.include establishes the initial list of candidate pairs. Its purpose is to remove certain pairs or types of pairs from further processing.

The process is:

  1. AutoConfig fetches all relevant tickers or configured pairs for the job's specified pairs.exchange.
  2. It filters this full list using the patterns in pairs.include. Only pairs matching at least one include pattern remain.
  3. From this included list, AutoConfig then removes any pairs that match at least one pattern in pairs.exclude.
  4. The final, refined list of pairs is then passed to the job's main filters (e.g., volume, volatility, custom filters).

The value for pairs.exclude is a string, allowing multiple patterns or exact pair names separated by commas.

Configuration and Pattern Matching Examples​

The exclude parameter is located within the pairs object of an AutoConfig job definition:

{
"stablecoinPairFocusJob": {
"enabled": true,
"type": "addPairs",
"schedule": "0 */6 * * *", // Runs every 6 hours
"strategy": "spotgrid",
"pairs": {
"exchange": "binance",
"include": "USDT-", // Initially include all pairs using USDT as the spending currency
"exclude": "USDT-BTC,USDT-ETH"
// User setting: Example of excluding specific USDT pairs like USDT-BTC and USDT-ETH.
// You could also exclude patterns like "-UNWANTEDPROJECT"
},
"filters": {
// ... filters for volume, volatility, etc. ...
}
}
}

In stablecoinPairFocusJob:

  • "include": "USDT-": The job first considers all pairs on Binance that use USDT as the base currency (e.g., USDT-BTC, USDT-ETH, USDT-ADA).
  • "exclude": "USDT-BTC,USDT-ETH": From the list of USDT pairs, this rule explicitly removes USDT-BTC and USDT-ETH. If USDT-ADA was also in the included set, it would remain.

The pattern matching for exclude is substring-based, similar to include:

  • "USDT-BTC": Excludes pairs containing USDT-BTC, including that spot pair and any matching suffixed pair names.
  • "-UNWANTED": Excludes pairs containing that quote-asset suffix (e.g., USDT-UNWANTED, BTC-UNWANTED if they were in the included set).
  • Full names like "USDT-BTCUP,USDT-BTCDOWN" can exclude specific leveraged-token markets if they were included.
  • "-STABLECOINX": Excludes pairs where STABLECOINX is the coin being bought and sold, such as USDT-STABLECOINX.

Key Use Cases for pairs.exclude​

  1. Blacklisting Problematic Pairs: If you find certain pairs are consistently unprofitable with your strategies or exhibit erratic behavior, you can add them to exclude (e.g., "exclude": "USDT-BTC" if USDT-BTC is problematic).
  2. Avoiding Specific Asset Types (Example): If leveraged tokens are part of a broader include like "include": "USDT-", exclude their full Gunbot pair names. For example, "exclude": "USDT-BTCUP,USDT-BTCDOWN" excludes those two markets if the exchange offers them. Use the exact token names shown by Gunbot.
  3. Filtering Out Specific Base/Quote Combinations: If your include is broad (e.g., "-"), you might use exclude to remove specific combinations like USDT-ETH if you only want to trade BTC against USDT from your allowed list, i.e., include: "USDT-", exclude: "USDT-ETH,BTC-ETH".
  4. Excluding Newly Listed/Unstable Coins: If a broad include pattern might pick up very new listings, you could temporarily add specific new pairs like USDT-NEWCOIN to exclude until they stabilize.
  5. Refining Category Selections: If include defines a category (e.g., by a common prefix like "USDT-"), exclude can remove specific members like USDT-ETH if you only want USDT-BTC from that category.

Best Practices​

  • Start with include: Always define your primary scope with pairs.include first. exclude is for refining that initial list, not for defining the main scope itself.
  • Be Specific When Needed: While wildcard-like patterns are useful, for blacklisting individual known problematic pairs, use their full, exact names in exclude for clarity.
  • Regular Review: If you use exclude to manage lists of unwanted coins, periodically review and update this list as new tokens are listed or old ones become irrelevant.
  • Test Your Patterns: The combination of include and exclude can sometimes have unintended consequences if patterns are too broad or overlap confusingly. If in doubt, test with a debug: true setting in your AutoConfig job and observe the "filtered pair list" messages in the logs to ensure it's behaving as expected.
  • Consider acUserData.json for Dynamic Blacklists: For very long or frequently changing blacklists, managing them in pairs.exclude within autoconfig.json can become cumbersome. An alternative is to maintain your blacklist in acUserData.json and use a custom filter in AutoConfig to check this.userData.myBlacklistedPairs.includes(this.pairName).

The pairs.exclude parameter provides an essential layer of control, letting you create precise and reliable pair selection logic in AutoConfig. By blacklisting unwanted pairs, you can better protect your capital, avoid problematic assets, and keep automated trading focused on suitable opportunities.