Skip to main content

The 'clearOverrides' option in AutoConfig 'manageOverrides' jobs

ยท 6 min read

When using Gunbot's AutoConfig feature to dynamically manage strategy parameters for your trading pairs (typically with a manageOverrides job type), you have fine-grained control over how new overrides are applied. The clearOverrides parameter is a boolean option that dictates whether existing pair-specific overrides should be wiped clean before the job applies its new set of 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 then apply override parameters to this pair in your config.js to customize its 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 job of type manageOverrides 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 job's overrides and the pair's existing overrides, the value from the AutoConfig job takes precedence (updates the existing value).
  • 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 own overrides object is empty (or not defined), it will effectively remove 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 might be managing different aspects of a pair's overrides, as they won't completely 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 completely 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 also 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 both targeted adjustments and complete profile changes, making your override management strategies more flexible and predictable.