Skip to main content

Filter pairs by 24-hour trading volume with AutoConfig

ยท 6 min read

A crucial factor in selecting viable trading pairs is their liquidity and market activity, often indicated by 24-hour trading volume. Gunbot's AutoConfig feature provides built-in filter types, minVolume24h and maxVolume24h, to automatically include or exclude pairs based on this metric. These filters help ensure that your automated strategies engage with markets that have sufficient activity.

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.

The Importance of Trading Volumeโ€‹

24-hour trading volume is a key indicator of a pair's liquidity and trader interest.

  • High Volume: Generally indicates good liquidity, meaning there are many buyers and sellers. This makes it easier to enter and exit positions at or near the current market price with minimal slippage.
  • Low Volume: Suggests poor liquidity. Trades can significantly impact the price, spreads can be wide, and filling orders can be difficult. Strategies may perform unreliably on low-volume pairs.

AutoConfig's volume filters allow you to automate pair selection based on these characteristics.

minVolume24h Filterโ€‹

The minVolume24h filter type is used to ensure that a pair has at least a certain amount of trading activity before it's considered by your AutoConfig job (e.g., for an addPairs job).

Configuration:

{
"activePairSelector": {
"enabled": true,
"type": "addPairs",
"schedule": "*/30 * * * *",
"pairs": {
"exchange": "binance",
"include": "-USDT" // Focus on USDT pairs
},
"filters": {
"ensureSufficientVolume": { // Your descriptive name for the filter rule
"filterType": "minVolume24h",
// The next key's name is arbitrary (e.g., minVol, minimumVolume, volume); its value is what matters.
"minRequiredVolume": 1000000 // Value is in quote currency (USDT in this case)
}
// ... other filters like volatility or spread ...
},
"strategy": "spotgrid"
}
}

In the ensureSufficientVolume filter:

  • "filterType": "minVolume24h" specifies the filter logic.
  • "minRequiredVolume": 1000000: This tells AutoConfig to check the quoteVolume field from the pair's latest ticker data. If this 24-hour volume (denominated in USDT for USDT-quoted pairs) is greater than 1,000,000, the filter passes for that pair. Otherwise, it fails.

maxVolume24h Filterโ€‹

The maxVolume24h filter type is less commonly used for adding pairs but can be useful for excluding extremely high-volume pairs if your strategy targets less saturated markets, or in combination with minVolume24h to find pairs within a specific volume range.

Configuration:

{
"mediumVolumeHunter": {
// ... job settings ...
"filters": {
"minimumActivity": {
"filterType": "minVolume24h",
"minVol": 200000
},
"notTooCrowded": {
"filterType": "maxVolume24h",
"maxVol": 5000000 // Value in quote currency
}
}
// ...
}
}

In mediumVolumeHunter, a pair would pass if its 24-hour volume is greater than 200,000 AND less than 5,000,000 (in its quote currency).

Key Considerationsโ€‹

  1. Quote Currency Denomination: The 24-hour volume provided by exchanges (and thus used by these filters, typically via the quoteVolume field in ticker data) is almost always in the quote currency of the pair.

    • For USDT-BTC, the volume threshold you set (e.g., 1,000,000) refers to USDT.
    • For BTC-ETH, the volume threshold refers to BTC (e.g., a minRequiredVolume of 50 would mean 50 BTC). Be mindful of this when setting thresholds for pairs with different quote currencies.
  2. Data Source: These filters rely on the quoteVolume (or equivalent like baseVolume * price if quoteVolume isn't directly available from CCXT for an exchange) field in the ticker data that AutoConfig fetches. Ensure your exchange provides reliable 24-hour volume data.

  3. Arbitrary Key Name for Value: In the filter definition (e.g., { "filterType": "minVolume24h", "yourKeyName": 1000000 }), the key name for the volume threshold (yourKeyName in this snippet, like minRequiredVolume or minVol in the examples) is arbitrary. AutoConfig primarily looks at the filterType and then takes the numerical value associated with the other key in that filter rule's object. However, using descriptive key names like minVolume or maxVolumeThreshold is good practice for readability.

  4. Dynamic Thresholds: While the examples show static numerical thresholds, you could potentially make these dynamic if the filter value were a string evaluated as JavaScript (though this is less common for these specific built-in types compared to custom filters or overrides). For example, by setting the threshold based on a global variable:

    "filters":{
    "dynamicMinVolume": {
    "filterType": "minVolume24h",
    // More reliably done via a custom filter if complex evaluation is needed for the threshold itself.
    "threshold": " this.variables.currentMinVolumeRequirement "
    }
    }
  5. Combining with Other Filters: Volume filters are most effective when used as part of a broader set of criteria, including volatility, spread, price range, etc., to identify genuinely suitable trading pairs.

Filtering by 24-hour trading volume is a fundamental step in refining your AutoConfig's pair selection process. By setting appropriate minVolume24h and (if needed) maxVolume24h thresholds, you can guide your Gunbot to focus on markets with adequate liquidity and activity levels that align with your trading strategy's requirements.