Skip to main content

The 'clearOverrides' option in AutoConfig 'manageOverrides' jobs

· 6 min read

Gunbot's AutoConfig lets you manage strategy parameters for trading pairs (typically with a manageOverrides job). The clearOverrides parameter is a boolean option that dictates whether existing pair-specific overrides are wiped before the job applies its new overrides.

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.

Understanding Override Application

In Gunbot, each trading pair runs an assigned base strategy. You can apply override parameters to the pair in config.js to customize behavior without altering the base strategy definition. For example:

// In config.js for a pair
"USDT-BTC": {
"strategy": "spotgrid",
"enabled": true,
"override": {
"GAIN": 1.2, // Original override
"STOP_LIMIT": 1 // Original override (example)
}
}

An AutoConfig manageOverrides job can modify these. The clearOverrides parameter controls how this modification happens.

Behavior with clearOverrides: false (Default)

If clearOverrides is set to false, or if it's omitted (as false is typically the default behavior):

  • The AutoConfig job's overrides object is merged with the pair's existing override block in config.js.
  • If a parameter exists in both, the value from the AutoConfig job takes precedence.
  • If a parameter is in the job's overrides but not in the pair's existing ones, it's added.
  • If a parameter is in the pair's existing overrides but not in the AutoConfig job's overrides object, it remains unchanged.

Example: Pair USDT-BTC has existing overrides: {"GAIN": 1.2, "STOP_LIMIT": 1}. An AutoConfig job with clearOverrides: false (or omitted) and the following overrides runs:

"overrides": {
"GAIN": 0.9, // This will update the existing GAIN
"BUY_ENABLED": false // This will be added
}

The resulting override for USDT-BTC in config.js will be:

"override": {
"GAIN": 0.9,
"STOP_LIMIT": 1, // This was untouched
"BUY_ENABLED": false
}

Behavior with clearOverrides: true

If clearOverrides is set to true:

  • All existing override parameters for the pair (that passes the job's filters) are completely removed first.
  • Then, the parameters defined in the AutoConfig job's overrides object are applied as the new, complete set of overrides for that pair.

Example: Pair USDT-BTC has existing overrides: {"GAIN": 1.2, "STOP_LIMIT": 1, "SELL_ENABLED": false}. An AutoConfig job with clearOverrides: true and the following overrides runs:

"overrides": {
"GAIN": 0.9,
"STOP_LIMIT": 3
}

The resulting override for USDT-BTC in config.js will be:

"override": {
"GAIN": 0.9,
"STOP_LIMIT": 3
}
// SELL_ENABLED is gone.

Special Case: clearOverrides: true with an Empty Job overrides Object If a job has clearOverrides: true but its overrides object is empty (or not defined), it removes all overrides from the pairs that pass its filters. This reverts the pair to using only the default settings from its assigned base strategy.

// Job to reset all overrides for specific pairs
{
"resetPairToDefaults": {
"type": "manageOverrides",
"clearOverrides": true, // User setting: Wipe existing overrides
// "overrides": {}, // Intentionally empty or omitted
"filters": { /* ... select which pairs to reset ... */ }
}
}

When to Use Which Setting

  • clearOverrides: false (or default):

    • Use when you want to incrementally adjust or add specific overrides without disturbing other existing custom settings for the pair.
    • Good for fine-tuning individual parameters based on conditions (e.g., "if volatile, just tighten STOP_LIMIT_PERCENT but leave other overrides alone").
    • Safer if multiple AutoConfig jobs manage different aspects of a pair's overrides, since they won't wipe each other's work (unless they target the same parameters).
  • clearOverrides: true:

    • Use when you want to apply a complete, specific "override profile" to a pair, ensuring no other stray or outdated overrides remain.
    • Useful for switching a pair to a different operational mode where previous overrides are irrelevant (e.g., switching from an accumulation override set to a profit-taking override set).
    • Essential for "reset to base strategy defaults" operations by providing an empty overrides object in the job.
    • When an addPairs job is configured to update existing pairs (if a pair that would be added already exists), clearOverrides: true can ensure the newly defined "initial" overrides for that job are cleanly applied, removing any prior state.

Configuration Location

The clearOverrides parameter is typically placed at the top level of the AutoConfig job definition, alongside type, schedule, etc.

{
"myOverrideManager": {
"enabled": true,
"type": "manageOverrides",
"schedule": "0 1 * * *",
"clearOverrides": true, // User setting applied here
"pairs": { /* ... */ },
"filters": { /* ... */ },
"overrides": { /* ... new overrides to apply ... */ }
}
}

Understanding the clearOverrides option gives you precise control over how AutoConfig jobs interact with your pairs' existing custom settings. Choosing true or false appropriately allows for targeted adjustments and complete profile changes, making override management more flexible and predictable.