When selecting trading pairs with Gunbot's AutoConfig, particularly for addPairs jobs, you might want to target or avoid pairs based on their absolute current price. For instance, you might prefer to avoid very low-priced "penny stock" style cryptocurrencies or, conversely, target only those below a certain price point. AutoConfig provides minPrice and maxPrice filter types to achieve this.
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.
Filtering by Absolute Price Levelsโ
The minPrice and maxPrice filters in AutoConfig operate on the current price of a pair as obtained from the latest ticker data snapshot. They allow you to define acceptable price ranges for pairs to be considered by an AutoConfig job.
filterType: "minPrice":- Purpose: Passes if the pair's current relevant price is greater than or equal to the specified minimum value.
- Use Case: To avoid extremely low-priced coins (e.g., those priced at fractions of a cent) if they don't fit your strategy or risk profile. Can also be used to target coins that have reached a certain minimum price level.
filterType: "maxPrice":- Purpose: Passes if the pair's current relevant price is less than or equal to the specified maximum value.
- Use Case: To avoid very high-priced coins if your capital per trade is limited, or if your strategy is designed for coins within a certain price ceiling. Can also be used to specifically target lower-priced assets.
Configurationโ
These filters are defined within an AutoConfig job's filters (or filters2, etc.) object:
{
"priceRangeSelector": {
"enabled": true,
"type": "addPairs",
"schedule": "0 * * * *", // Hourly
"pairs": {
"exchange": "binance",
"include": "-USDT"
},
"filters": {
"abovePennyStockLevel": { // Rule name (arbitrary)
"filterType": "minPrice",
// The next key's name is arbitrary; its value is the price threshold.
"minimumAcceptablePrice": 0.01 // Price in USDT
},
"notTooExpensive": { // Rule name (arbitrary)
"filterType": "maxPrice",
"maximumAcceptablePrice": 100.00 // Price in USDT
}
// ... other filters like volume, spread ...
},
"strategy": "spotgrid"
}
}
In the priceRangeSelector job:
- The
abovePennyStockLevelfilter usesminPrice. It will pass for a pair if its current price (e.g., ask price from the ticker) is0.01USDT or higher. - The
notTooExpensivefilter usesmaxPrice. It will pass if the pair's current price is100.00USDT or lower. - For a pair to be added by this job, it must pass both these price filters (and any other filters defined in the set), meaning its price must be between $0.01 and $100.00 USDT.
Key Considerationsโ
Price Source:
- For
addPairsjobs evaluating new market tickers, the price used for comparison is typically the current ask price from the ticker data (this.tickers[jobName][...][pairName].ask). - For jobs operating on existing pairs (like
manageOverridesorremovePairs), the price might be the bid price or last traded price from the ticker data, depending on the context and specific internal logic of the filter for that job type. It's always based on the latest available ticker information. - On exchanges like Huobi where
ask/bidmight not be directly available in all ticker fetches, it might uselastprice.
- For
Quote Currency: The price values you specify (e.g.,
0.01,100.00) are always in the quote currency of the pair being evaluated.- For
BTC-USDT, the thresholds are in USDT. - For
ETH-BTC, the thresholds would be in BTC. You must adjust your price thresholds accordingly if yourpairs.includecovers pairs with different quote currencies.
- For
Arbitrary Key Name for Value: In the filter definition (e.g.,
{ "filterType": "minPrice", "myKey": 0.01 }), the key name for the price threshold (myKeyin this snippet) is arbitrary and for your description only. AutoConfig uses thefilterTypeand then expects the numerical value associated with the other key in that filter rule's object.Combining Filters:
minPriceandmaxPriceare often used together to define a specific price range, as shown in the example. They are also typically combined with other filters like volume (minVolume24h) and spread (maxSpreadPct) for more robust pair selection.Dynamic Thresholds via Custom Filters: If you need the price thresholds themselves to be dynamic (e.g., based on a global variable or
acUserData.json), these built-inminPrice/maxPricefilters might not directly support evaluated strings for their threshold values. In such cases, acustomJavaScript filter would be more appropriate, where you can write logic like:// Custom filter script
// const latestAsk = this.tickers[jobName][this.tickers[jobName].length-1][this.pairName].ask;
// const minPriceThreshold = this.variables.currentMinPriceTarget || 0.005;
// return latestAsk >= minPriceThreshold;
Using minPrice and maxPrice filters allows you to easily incorporate absolute price level criteria into your AutoConfig job's decision-making process, helping to refine pair selection to tranches that fit your strategy's capital requirements or risk preferences.