Skip to main content

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

ยท 6 min read

When using Gunbot's AutoConfig feature with the addPairs job type, one of the fundamental configurations is specifying which trading strategy should be assigned to the newly discovered pairs that pass your filters. This is done using the strategy parameter directly within the addPairs job definition.

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โ€‹

The primary purpose of an addPairs AutoConfig job is to scan an exchange for trading pairs that meet your criteria (defined by filters) and then add these qualifying pairs to your main Gunbot config.js file, making them active for trading.

For these newly added pairs to be functional, Gunbot needs to know which trading logic to apply to them. The strategy parameter within the addPairs job definition serves this exact purpose. It tells AutoConfig: "If a pair passes all filters in this job, add it to config.js and assign this specific strategy to it."

The value for the strategy parameter must be a string that exactly matches the name of a strategy already defined in the strategies section of your main config.js file (e.g., "spotgrid", "stepgrid", "emotionless", or any custom strategy name you've created).

Configuration Exampleโ€‹

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

{
"discoverNewAltsJob": {
"enabled": true,
"type": "addPairs", // This job's function is to add pairs
"schedule": "0 */4 * * *", // Runs every 4 hours
"strategy": "stepgrid", // User setting: 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": This is the crucial line. Any pair on Binance that is USDT-based, has a 24-hour volume over 500,000, and volatility over 2.0% will be added to config.js and will have the stepgrid strategy assigned to it.
  • The overrides object is also often used in addPairs jobs to set initial specific parameters for the newly added pairs, which will complement the base settings from the assigned stepgrid strategy.

If the strategy parameter were missing, the addPairs job might successfully identify and list pairs based on filters, but it wouldn't know how to configure them for trading in config.js, potentially leading to errors or inactive pairs.

Key Considerationsโ€‹

  1. Strategy Must Exist: The strategy name you provide (e.g., "stepgrid") must correspond to an existing, valid strategy definition in your config.js file's strategies section. If the strategy doesn't exist, Gunbot won't be able to assign it, and the newly added pairs may not function correctly.
  2. One Strategy Per addPairs Job: A single addPairs job assigns only one strategy (the one specified in its strategy parameter) to all pairs it successfully adds.
    • If you want to add some pairs with "strategyA" and others with "strategyB" based on different criteria, you would typically create two separate addPairs AutoConfig jobs. Each job would have its own set of filters and its own distinct strategy parameter.
  3. Case Sensitivity (Generally Insensitive but Be Precise): While Gunbot and AutoConfig are often case-insensitive with strategy names in filters (strategyName), it's best practice to use the exact casing for the strategy name in the strategy parameter of an addPairs job as it appears in your config.js strategies definitions to ensure clarity and avoid potential issues.
  4. Complements overrides: The strategy parameter works alongside the overrides object within the addPairs job. The assigned strategy provides the base set of parameters, and the overrides then fine-tune specific settings for the newly added pairs.
  5. Post-Addition Management: Once a pair is added with a default strategy, you can later use other AutoConfig job types like manageOverrides or changeStrategy to dynamically alter its settings or switch its strategy based on evolving conditions or performance.

The strategy parameter is a cornerstone of the addPairs job type in AutoConfig. It bridges the gap between discovering promising trading opportunities and integrating them into your active Gunbot trading setup with a defined operational logic. Always ensure it points to a valid, well-configured strategy in your main Gunbot settings.