Skip to main content

Specify default strategy for pairs added by AutoConfig 'addPairs' job

· 4 min read

When using Gunbot's AutoConfig with an addPairs job, set the strategy parameter so newly discovered pairs that pass your filters get a default strategy.

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 Role of the strategy Parameter in addPairs

An addPairs job scans an exchange for pairs that match your filters, then adds those pairs to your main config.js. The strategy parameter tells AutoConfig which strategy to assign to each newly added pair, so the pair is ready to trade.

Use a strategy name that already exists in the strategies section of your config.js file (for example, "spotgrid", "stepgrid", or a custom strategy name).

Configuration Example

Here's how the strategy parameter is used within an addPairs job:

{
"discoverNewAltsJob": {
"enabled": true,
"type": "addPairs",
"schedule": "0 */4 * * *", // Runs every 4 hours
"strategy": "stepgrid", // Assign 'stepgrid' to newly added pairs
"pairs": {
"exchange": "binance",
"include": "USDT-" // Consider USDT-based pairs
},
"filters": {
"minVolume": {
"filterType": "minVolume24h",
"minVolume": 500000
},
"minVolatility": {
"filterType": "minVolatilityPct24h",
"minVolatility": 2.0
}
},
"overrides": { // Optional: assign default overrides too
"STOP_LIMIT": 1.0, // Example: Set a default stop limit
"GAIN": 0.8
},
"maxPairs": 20 // From pairs.maxPairs in expanded list, but often a top-level interpretation for the job
}
}

In the discoverNewAltsJob example:

  • "type": "addPairs" defines its core function.
  • "strategy": "stepgrid" assigns stepgrid to any pair that passes the filters and gets added to config.js.
  • The optional overrides object sets per-pair settings that complement the assigned strategy.

If the strategy parameter is missing, the job can still discover pairs but won't know which strategy to assign in config.js.

Key Considerations

  1. Strategy must exist: The strategy value must match a strategy defined in config.js. If it doesn't exist, Gunbot cannot assign it.
  2. One strategy per job: Each addPairs job assigns a single strategy to all pairs it adds. Use separate jobs if you need different strategies.
  3. Use the exact name: Match the strategy name as it appears in your config.js strategies section.
  4. Works with overrides: strategy defines the base logic, while overrides can fine-tune per-pair settings.
  5. Post-addition changes: You can use other AutoConfig job types like manageOverrides or changeStrategy later if you want to adjust strategy or settings.

The strategy parameter connects pair discovery to an actual trading setup by assigning a defined strategy to each newly added pair. Ensure it points to a valid strategy in your main Gunbot configuration.