Skip to main content

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

ยท 6 min read

While the pairs.include parameter in Gunbot's AutoConfig defines the initial watchlist for a job, the pairs.exclude parameter provides a way to further refine this list by blacklisting specific pairs or patterns. Pairs matching an exclude pattern are removed from consideration, even if they initially matched an include pattern. This allows for precise control over which pairs an AutoConfig job will ultimately 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 has established an initial list of candidate pairs. Its purpose is to explicitly remove certain pairs or types of pairs from being processed further by the AutoConfig job.

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 USDT quoted pairs
"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 are quoted in USDT (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 only the exact pair USDT-BTC.
  • "UNWANTED-": Excludes all pairs starting with UNWANTED- (e.g., UNWANTED-USDT, UNWANTED-BTC if they were in the included set).
  • Patterns like "UP-", "DOWN-" can be used to exclude common leveraged token prefixes if they were broadly included.
  • "STABLECOINX-": If you have a category of stablecoins you wish to avoid trading as base assets (and they were part of the include set).

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 certain types of assets (e.g., hypothetical leveraged tokens if they were part of a broader include like "include": "-" ) are not desired, their patterns can be excluded. For example, if UPUSDT-BTC and DOWNUSDT-BTC were leveraged versions of USDT-BTC, you might use "exclude": "UPUSDT-,DOWNUSDT-". (Note: This is illustrative as exact leveraged token naming varies).
  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 NEWCOIN-USDT (if it were an allowed pair format) 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, allowing you to create precise and robust pair selection logic in AutoConfig. By effectively blacklisting unwanted pairs, you can better protect your capital, avoid problematic assets, and keep your automated trading focused on the most suitable opportunities.