Engine

Engine Configuration Scheme #

The engine configuration scheme is divided into three sections, each responsible for different aspects of the engine:

  • engine - configures the engine’s behaviour and its ability to process cycles and strategies.
  • scouts - configures scouts/external services (e.g., Telegram). If no scouts are being used, this section may be omitted.
  • strategies - configures strategies, their calculations and potential results. Note that if a strategy is using a tool or an outcome that depends on a scout, that specific scout must be configured in the scouts section as well.

Configuration scheme example:

{
	"engine": {
		"cycle": {
			"cooldown": "2h0m0s",
			"timeout": "5m0s"
		},
		"symbol": {
			"lineup": {
				"ETH_BTC": true,
				"BTC_USDT": true
			},
			"default": {
				"max_cycles": 5,
				"max_uptime": "2h0m0s",
				"timeout": "1h15m0s",
				"exec": [
					"strategy1"
				]
			},
			"dedicated": {
				"BTC_USDT": {
					"max_cycles": 10,
					"max_uptime": "5h0m0s",
					"timeout": "3h14m15s",
					"exec": [
						"strategy1"
					]
				}
			}
		}
	},
	"scouts": {
		"telegram": {
			"token": "9bsv0s78ajk0036f3m60"
		}
	},
	"strategies": {
		"strategy1": {
			"candle_interval": "5mins",
			"timeout": "18m15s",
			"tools": [
				{
					"type": "placeholder",
					"permit": true
				}
			],
			"outcomes": [
				{
					"type": "placeholder"
				}
			]
		}
	}
}

Core Engine Configuration #

The engine section in the engine configuration scheme consists of two parts:

  • cycle - configures how the engine cycles are processed.
  • symbol - configures what symbols should be prepared and how their execution should be performed.
{
	"cycle": {
		"cooldown": "2h0m0s",
		"timeout": "5m0s"
	},
	"symbol": {
		"lineup": {
			"ETH_BTC": true,
			"BTC_USDT": true
		},
		"default": {
			"max_cycles": 5,
			"max_uptime": "2h0m0s",
			"timeout": "1h15m0s",
			"exec": [
				"strategy1"
			]
		},
		"dedicated": {
			"BTC_USDT": {
				"max_cycles": 10,
				"max_uptime": "5h0m0s",
				"timeout": "3h14m15s",
				"exec": [
					"strategy1"
				]
			}
		}
	}
}
  • cycle - object
    The engine cycles’ processing configuration.

    • cooldown - string (duration)
      The amount of time the engine waits before starting a new cycle. It must be a positive value.

      Before starting the very first cycle, the engine does not use the value specified here.

    • timeout - string (duration; optional; default: unused)
      The amount of time an active cycle is given to complete. It cannot be a negative value.

      If the value is zero or not provided, there is no time limit.

  • symbol - object
    The symbols’ processing configuration.

    • lineup - map (string: boolean)
      The map of symbols that the engine should include in the active configuration session. The boolean value determines whether by default the symbol should be enabled (true) or disabled (false). At least one symbol must be specified.

      The disabled symbols of the active configuration can be enabled at any point by sending a request with appropriate data to the session update endpoint.

    • default - object
      The default configuration that is used by every symbol that does not have a dedicated configuration.

      • max_cycles - unsigned int (optional; default: unused)
        The maximum number of cycles a symbol can be enabled. If it is manually re-enabled, the same limit is applied (counting starts from zero).

        If the value is zero or not provided, there is no cycle limit.

      • max_uptime - string (duration; optional; default: unused)
        The maximum amount of time a symbol can be enabled. If it is manually re-enabled, the same limit is applied (time tracking starts from zero). It cannot be a negative value.

        If the value is zero or not provided, there is no time limit.

      • timeout - string (duration; optional; default: unused)
        The amount of time a symbol’s process is given to complete during a single cycle. It cannot be a negative value.

        If the value is zero or not provided, there is no time limit.

      • exec - array of strings
        The array of strategies to execute. At least one strategy must be specified.

        The array contains only references to strategies defined in the strategies section as described here.

    • dedicated - map (string: object; optional; default: unused)
      The symbol-dedicated configurations that override the default symbol configuration. The properties and their limitations are the same as the default ones.

Scouts Configuration #

The scouts section in the engine configuration scheme has a section dedicated to each scout/service.

{
	"telegram": {
		"token": "9bsv0s78ajk0036f3m60"
	}
}
  • telegram - object (optional; default: unused)
    The Telegram bot client’s configuration.
    • token - string
      The Telegram bot’s authorization token. Instructions on how to obtain one are here.

Strategies Configuration #

The strategies section in the engine configuration scheme is a map of strategy names along with their configuration objects. The strategy configuration structure is described in detail here.

Engine Configuration Session #

When the engine is started, the configuration it uses becomes read-only, which means no changes are permitted until the engine is stopped. However, there may be times when a smoothly running engine needs a slight readjustment of the list of symbols it uses to avoid strange and possibly risky market conditions. For this exact purpose, the engine creates an ephemeral configuration session that contains those readjustments, tracks how and when they were made, and, most importantly, keeps it separate from the actual configuration. This also means that a configuration session is reset each time the engine is restarted.

{
	"symbols": {
		"ETH_BTC": {
			"enabled_at": "2020-10-10T21:01:20Z",
			"first_cycle": 30
		},
		"BTC_USDT": {
			"enabled_at": "2020-10-10T22:01:20Z",
			"disabled_at": "2020-10-10T22:01:20Z",
			"first_cycle": 30,
			"last_cycle": 42
		}
	}
}
  • symbols - map (string: object)
    The map of symbols included in the active session. Each symbol string has a metadata object along with it. Its properties are:
    • enabled_at - string (RFC 3339)
      The exact time when the symbol was enabled.

    • disabled_at - string (RFC 3339)
      The exact time when the symbol was disabled.

      This property is omitted if the symbol is still enabled.

    • first_cycle - unsigned int
      The number of the cycle during which the symbol was enabled.

    • last_cycle - unsigned int
      The number of the cycle during which the symbol was disabled.

      This property is omitted if the symbol is still enabled.