When automating pair removal with Gunbot's AutoConfig removePairs job type, you need to consider whether the bot still holds quote currency for the pair (a "bag"). The pairs.noBag option adds a safeguard: only delist a pair when the quote balance is below the strategy’s MIN_VOLUME_TO_SELL (MVTS) threshold and there are no open orders.
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 Problem of "Stranded Bags"
If a removePairs job delists a pair from config.js while Gunbot still holds quote currency (for example, you hold 1 ETH in a USDT-ETH pair and USDT-ETH is removed), Gunbot stops actively managing that asset. It won’t sell according to the assigned strategy because the pair configuration is gone, which can leave "stranded assets" or "stuck bags" you must manage manually.
The pairs.noBag option is designed to prevent this scenario by adding a crucial precondition to the removal process.
How pairs.noBag: true Works
When you include pairs.noBag: true in the pairs object of an AutoConfig job with type: "removePairs" (or "removePairs2"):
- Pair evaluation: The job iterates through the pairs defined by
pairs.include/pairs.excludethat are older thanpairs.notRemoveBefore(if set). - "No bag" check (precondition): For each candidate pair, before evaluating the job's main
filters(like low profit, low volume), AutoConfig performs the "no bag" check. This check typically verifies:this.pair.quoteBalance: The amount of quote currency held for the pair.this.pair.Ask: The current ask price, to value the quote balance.MIN_VOLUME_TO_SELL(MVTS): The minimum value (in base currency) required for a sell order, as defined by the pair's strategy.this.pair.openOrders: Checks if there are any open orders.this.pair.reversal: Checks if the pair is currently in a reversal trading process (e.g. after a stop-loss). A pair is considered to have "no bag" if(quoteBalance * Ask) < MIN_VOLUME_TO_SELLAND there are no open orders AND no active reversal. Essentially, any remaining quote currency is dust or insignificant.
- Filter Evaluation:
- If the "no bag" check passes (meaning no significant bag is held, no open orders, no reversal), then and only then will the job proceed to evaluate the pair against its main
filtersblock (e.g., low profit, low volume). - If the "no bag" check fails (meaning a significant bag exists, or there are open orders/reversal), the pair is skipped for that run of the
removePairsjob, regardless of whether it would meet the other removal criteria. It's protected from removal to allow Gunbot to continue managing the existing bag.
- If the "no bag" check passes (meaning no significant bag is held, no open orders, no reversal), then and only then will the job proceed to evaluate the pair against its main
Configuration Example
Here's a removePairs job configured to only delist pairs if they have no significant holdings:
{
"safePairRemover": {
"enabled": true,
"type": "removePairs",
"schedule": "0 3 * * *", // Runs daily at 3 AM
"pairs": {
"exchange": "binance",
"include": "-USDT",
"notRemoveBefore": 10080, // Only consider pairs older than 1 week
"noBag": true // User setting: Only proceed if no significant bag is held
},
"filters": { // These filters apply ONLY if 'noBag' condition is true
"isUnprofitable": {
"filterType": "custom",
"script": "return (this.pair && typeof this.pair.profit === 'number' && this.pair.profit < -5);" // Example: profit < -5%
},
"hasLowActivity": {
"filterType": "maxVolume24h",
"maxVol": 100000 // Volume less than 100k USDT
}
}
}
}
In the safePairRemover job:
- It targets USDT pairs on Binance older than one week.
- Because
"noBag": true:- For each candidate pair, it first checks if
(quoteBalance * Ask) < MVTSand no open orders/reversal. - If
true(no bag), it then checks if the pair is unprofitable OR has low activity. If those filters pass, the pair is removed. - If
false(a bag exists), the pair is NOT removed in this job run, even if it's unprofitable and has low activity.
- For each candidate pair, it first checks if
Benefits of pairs.noBag: true
- Asset protection: Prevents AutoConfig from delisting pairs where you still have funds invested, avoiding stranded assets.
- Safer automation: Makes the
removePairsprocess safer because it respects existing positions. - Works with sell strategies: Gives Gunbot time to divest the quote currency before a pair is removed from active management.
- Dust management: By comparing against MVTS, it allows removal if the remaining balance is dust and not worth actively managing.
Important Considerations
- Ledger accuracy (
this.pairdata): ThenoBagcheck relies on accurate ledger information (quoteBalance,openOrders,reversal) maintained by Gunbot for the pair. MIN_VOLUME_TO_SELL(MVTS): The dust check depends on MVTS being set appropriately in your strategies. If MVTS is extremely low, even small amounts of quote currency might be considered a "bag".- Patience required: With
noBag: true, pairs with bags will not be removed until Gunbot sells those bags. If a coin is in deep loss and your strategy isn't selling, the pair can remain active indefinitely, which may be the desired behavior to avoid manual losses. - Alternative:
pairs.bag: trueformanageOverrides: If you want to take actions because a bag exists (such as aggressive selling overrides), use amanageOverridesjob withpairs.bag: truein itsfiltersor as a separate condition.noBagis specifically for preventing removal when a bag exists.
Using pairs.noBag: true is a recommended best practice for most removePairs AutoConfig setups. It helps ensure automated cleanup does not interfere with active positions or leave unmanaged funds, adding a safety layer to portfolio management.