Engine

Engine Endpoints #

Engine Configuration Endpoints #

Active Engine Configuration Retrieval #

GET /engine/configs/active

Retrieves the active engine configuration.

Authentication required: yes

Permissions: engine-configs-read

Query parameters: none

Request body: none

Response body:

{
	"config": {
		"id": "9bsv0s78ajk0036f3m60",
		"created_at": "2020-09-10T21:01:20Z",
		"updated_at": "2020-09-10T21:01:20Z",
		"used_at": "2020-10-10T20:01:20Z",
		"name": "engine1",
		"scheme": {
			"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"
							]
						}
					}
				}
			},
			"strategies": {
				"strategy1": {
					"candle_interval": "5mins",
					"timeout": "18m15s",
					"tools": [
						{
							"type": "placeholder",
							"permit": true
						}
					],
					"outcomes": [
						{
							"type": "placeholder"
						}
					]
				}
			}
		}
	},
	"session": {
		"symbols": {
			"ETH_BTC": {
				"enabled_at": "2020-10-10T21:01:20Z",
				"first_cycle": 30
			},
			"BTC_USDT": {
				"enabled_at": "2020-10-10T22:01:20Z",
				"first_cycle": 30
			}
		}
	}
}
  • config - object
    The engine configuration data.

    Engine configuration properties are described in detail here.

  • session - object
    The engine configuration session data.

    Engine configuration session properties are described in detail here.

Engine Configuration Activation #

PUT /engine/configs/active

Activates an engine configuration.

The engine must be stopped before activation.

Authentication required: yes

Permissions: engine-configs-write

Query parameters: none

Request body:

{
	"id": "9bsv0s78ajk0036f3m60"
}
  • id - string (optional; default: unused)
    The ID of the engine configuration to activate.
    If not provided, the last used engine configuration is activated.

Response body: none

Active Engine Configuration Session Update #

PATCH /engine/configs/active/session

Updates the active engine configuration session. These changes do not affect the actual configuration, only its active session which resets on each engine restart.

Engine configuration session is described in detail here.

Authentication required: yes

Permissions: engine-configs-write

Query parameters: none

Request body:

{
	"symbols": {
		"BTC_USDT": true,
		"ETH_BTC": false
	}
}
  • symbols - map (string: boolean; optional; default: unused)
    The map of symbols along with their statuses. The boolean value determines whether the symbol should be enabled (true) or disabled (false).
    Only symbols that are specified in the lineup map in the active engine configuration may be enabled or disabled.

Response body: none

Engine Configuration Retrieval #

GET /engine/configs/{id}

Retrieves an engine configuration by its ID.

Authentication required: yes

Permissions: engine-configs-read

Query parameters: none

Request body: none

Response body:

{
	"id": "9bsv0s78ajk0036f3m60",
	"created_at": "2020-09-10T21:01:20Z",
	"updated_at": "2020-09-10T21:01:20Z",
	"used_at": "2020-10-10T20:01:20Z",
	"name": "engine1",
	"scheme": {
		"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"
						]
					}
				}
			}
		},
		"strategies": {
			"strategy1": {
				"candle_interval": "5mins",
				"timeout": "18m15s",
				"tools": [
					{
						"type": "placeholder",
						"permit": true
					}
				],
				"outcomes": [
					{
						"type": "placeholder"
					}
				]
			}
		}
	}
}
  • id - string
    The ID of the engine configuration.

  • created_at - string (RFC 3339)
    The exact time when the engine configuration was created.

  • updated_at - string (RFC 3339)
    The exact time when the engine configuration was updated.

  • used_at - string (RFC 3339)
    The exact time when the engine configuration was last used.

  • name - string
    The name of the engine configuration.

  • scheme - object
    The engine configuration scheme.

    Engine configuration scheme properties are described in detail here.

Multiple Engine Configurations Retrieval #

GET /engine/configs

Retrieves multiple engine configurations.

Authentication required: yes

Permissions: engine-configs-read

Query parameters:

  • limit - unsigned int
    The number of engine configurations per page.

  • page - unsigned int
    The engine configuration batch index.

  • omissions - array of strings (optional; default: unused)
    The array containing properties that are omitted from each returned engine configuration object. Possible values:

    • scheme
  • filter-name-includes - string (optional; default: unused)
    If specified, only engine configurations whose names include this value are returned. The filtering process is case-insensitive.

    filter-name-includes should be used as the default search bar filter.

  • sort-{index}-created-at - string (enum; optional; default: unused)
    If specified, engine configurations are sorted by their creation timestamps. The value determines whether ascending (asc) or descending (desc) order is used.

  • sort-{index}-updated-at - string (enum; optional; default: unused)
    If specified, engine configurations are sorted by their update timestamps. The value determines whether ascending (asc) or descending (desc) order is used.

  • sort-{index}-used-at - string (enum; optional; default: unused)
    If specified, engine configurations are sorted by their last use timestamps. The value determines whether ascending (asc) or descending (desc) order is used.

  • sort-{index}-name - string (enum; optional; default: unused)
    If specified, engine configurations are sorted by their names. The value determines whether ascending (asc) or descending (desc) order is used.

Many different filter- and sort- keys may be used at the same time, however, to ensure predictable sorting, sort- keys must include an index denoting their precendence. For example, if ?sort-1-name=asc&sort-2-created-at=desc query is being used, engine configurations are first sorted by their names and only then by their creation timestamps.

Request body: none

Response body:

{
	"page_count": 300,
	"configs": [
		{
			"id": "9bsv0s78ajk0036f3m60",
			"created_at": "2020-09-10T21:01:20Z",
			"updated_at": "2020-09-10T21:01:20Z",
			"used_at": "2020-10-10T20:01:20Z",
			"name": "engine1",
			"scheme": {
				"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"
								]
							}
						}
					}
				},
				"strategies": {
					"strategy1": {
						"candle_interval": "5mins",
						"timeout": "18m15s",
						"tools": [
							{
								"type": "placeholder",
								"permit": true
							}
						],
						"outcomes": [
							{
								"type": "placeholder"
							}
						]
					}
				}
			}
		}
	]
}
  • page_count - unsigned int
    The number of available pages that may be retrieved with the same filtering options.

  • configs - array of objects
    The array of engine configurations.

    Engine configuration properties are described in detail here.

Engine Configuration Count Retrieval #

GET /engine/configs/count

Retrieves the total number of engine configurations.

Authentication required: yes

Permissions: engine-configs-read

Query parameters: none

Request body: none

Response body:

{
	"count": 300
}
  • count - unsigned int
    The total number of engine configurations.

Engine Configuration Creation #

POST /engine/configs

Creates a new engine configuration.

Authentication required: yes

Permissions: engine-configs-write

Query parameters: none

Request body:

{
	"name": "engine1",
	"scheme": {
		"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"
						]
					}
				}
			}
		},
		"strategies": {
			"strategy1": {
				"candle_interval": "5mins",
				"timeout": "18m15s",
				"tools": [
					{
						"type": "placeholder",
						"permit": true
					}
				],
				"outcomes": [
					{
						"type": "placeholder"
					}
				]
			}
		}
	}
}
  • name - string
    The name of the new engine configuration. It must match the following regexp: ^[\w-.]+$

  • scheme - object
    The engine configuration scheme.

    Engine configuration scheme properties are described in detail here.

Response body:

{
	"id": "9bsv0s78ajk0036f3m60",
	"created_at": "2020-09-10T21:01:20Z",
	"updated_at": "2020-09-10T21:01:20Z",
	"used_at": "2020-10-10T20:01:20Z",
	"name": "engine1",
	"scheme": {
		"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"
						]
					}
				}
			}
		},
		"strategies": {
			"strategy1": {
				"candle_interval": "5mins",
				"timeout": "18m15s",
				"tools": [
					{
						"type": "placeholder",
						"permit": true
					}
				],
				"outcomes": [
					{
						"type": "placeholder"
					}
				]
			}
		}
	}
}
Engine configuration properties are described in detail here.

Engine Configuration Update #

PATCH /engine/configs/{id}

Updates an engine configuration by its ID.

The active engine configuration can be updated only when the engine is stopped.

Authentication required: yes

Permissions: engine-configs-write

Query parameters: none

Request body:

{
	"name": "engine1",
	"scheme": {
		"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"
						]
					}
				}
			}
		},
		"strategies": {
			"strategy1": {
				"candle_interval": "5mins",
				"timeout": "18m15s",
				"tools": [
					{
						"type": "placeholder",
						"permit": true
					}
				],
				"outcomes": [
					{
						"type": "placeholder"
					}
				]
			}
		}
	}
}
  • name - string (optional; default: unused)
    The new name of the engine configuration. It must match the following regexp: ^[\w-.]+$

  • scheme - object (optional; default: unused)
    The new engine configuration scheme.

    Engine configuration scheme properties are described in detail here.

Response body: none

Engine Configuration Deletion #

DELETE /engine/configs/{id}

Deletes an engine configuration by its ID.

The active engine configuration cannot be deleted.

Authentication required: yes

Permissions: engine-configs-write

Query parameters: none

Request body: none

Response body: none

Engine Strategy Endpoints #

Engine Strategy Backtesting #

POST /engine/strategies/backtest

Backtests an engine strategy.

Strategy outcomes are not executed during the backtesting process.

Authentication required: yes

Permissions: engine-configs-read

Query parameters: none

Request body:

{
	"symbol": "BTC_USDT",
	"end_time": "2020-09-10T21:01:20Z",
	"frames": 20,
	"strategy": {
		"candle_interval": "5mins",
		"timeout": "18m15s",
		"tools": [
			{
				"type": "placeholder",
				"permit": true
			}
		],
		"outcomes": [
			{
				"type": "placeholder"
			}
		]
	}
}
  • symbol - string
    The symbol to use during testing.

  • end_time - string (RFC 3339)
    Specifies the end timestamp for the candles.

  • frames - unsigned int
    The number of candles to test.

  • strategy - object
    The strategy that should be tested.

    Strategy properties are described in detail here.

Response body:

{
	"frames": [
		[
			{
				"type": "placeholder",
				"permit": true
			},
			{
				"type": "placeholder",
				"permit": true
			}
		],
		[
			{
				"type": "placeholder",
				"permit": true
			},
			{
				"type": "placeholder",
				"permit": true
			}
		]
	],
	"exchange": {
		"candles": [
			{
				"opened_at": "2020-09-10T21:01:20Z",
				"open": "2",
				"high": "3",
				"low": "4",
				"close": "5",
				"volume": "6"
			},
			{
				"opened_at": "2020-09-10T21:03:20Z",
				"open": "3",
				"high": "4",
				"low": "5",
				"close": "6",
				"volume": "7"
			}
		]
	}
}
Strategy backtesting report properties are described in detail here.

Engine State Endpoints #

Engine State Retrieval #

GET /engine/state

Retrieves the engine’s state along with its metadata.

Authentication required: yes

Permissions: engine-state-read

Query parameters: none

Request body: none

Response body:

{
	"running": true,
	"changed_at": "2020-09-10T21:01:20Z",
	"uptime": "1h0m0s"
}
  • running - boolean
    Specifies whether the engine is running or not.

  • changed_at - string (RFC 3339)
    The exact time when the state of the engine was changed (e.g., from running to idle).

  • uptime - string (duration)
    Specifies the duration that has elapsed since the start of the engine’s process.

Engine State Update #

PUT /engine/state

Updates the engine’s state.

Authentication required: yes

Permissions: engine-state-write

Query parameters: none

Request body:

{
	"action": "stop",
	"hard": true
}
  • action - string (enum)
    The type of action to execute. Possible values:

    • start
    • stop
    • restart
  • hard - boolean (optional; default: false)
    If specified, determines whether the action should be executed as soon as possible, which might require forceful termination of the active cycle. This value is used only with stop and restart actions.

Response body: none

Engine Cycle Endpoints #

Active Engine Cycle Retrieval #

GET /engine/cycles/active

Retrieves the active engine cycle.

Authentication required: yes

Permissions: engine-cycles-read

Query parameters: none

Request body: none

Response body:

{
	"session_id": "9bsv0s78ajk0036f3m60",
	"number": 300,
	"started_at": "2020-09-10T21:01:20Z"
}
  • session_id - string
    The session ID of the engine cycle.

  • number - unsigned int
    The number of the engine cycle.

  • started_at - string (RFC 3339)
    The exact time when the engine cycle was started.

    The default/zero time value indicates that the engine is waiting for the next cycle to start.

Engine Cycle Retrieval #

GET /engine/cycles/{id}

Retrieves an engine cycle by its ID.

Authentication required: yes

Permissions: engine-cycles-read

Query parameters: none

Request body: none

Response body:

{
	"id": "9bsv0s78ajk0036f3m60",
	"session_id": "38sv0s78ajk0036f3m60",
	"number": 300,
	"started_at": "2020-09-10T21:01:20Z",
	"completed_at": "2020-09-10T21:02:20Z",
	"report": {
		"snapshot": {
			"config": {
				"id": "12sv0s78ajk0036f3m60",
				"name": "engine1",
				"scheme": {
					"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"
									]
								}
							}
						}
					},
					"strategies": {
						"strategy1": {
							"candle_interval": "5mins",
							"timeout": "18m15s",
							"tools": [
								{
									"type": "placeholder",
									"permit": true
								}
							],
							"outcomes": [
								{
									"type": "placeholder"
								}
							]
						}
					}
				}
			},
			"session": {
				"symbols": {
					"ETH_BTC": {
						"enabled_at": "2020-10-10T21:01:20Z",
						"first_cycle": 30
					},
					"BTC_USDT": {
						"enabled_at": "2020-10-10T22:01:20Z",
						"first_cycle": 30
					}
				}
			}
		},
		"symbols": {
			"ETH_BTC": {
				"strategy1": {
					"tools": [
						{
							"type": "placeholder",
							"permit": true
						}
					],
					"outcomes": [
						{
							"type": "placeholder"
						}
					],
					"exchange": {
						"candles": [
							{
								"opened_at": "2020-09-10T21:01:20Z",
								"open": "2",
								"high": "3",
								"low": "4",
								"close": "5",
								"volume": "6"
							},
							{
								"opened_at": "2020-09-10T21:03:20Z",
								"open": "3",
								"high": "4",
								"low": "5",
								"close": "6",
								"volume": "7"
							}
						]
					}
				}
			},
			"BTC_USDT": {
				"strategy1": {
					"interrupted": true
				}
			}
		}
	}
}
  • id - string
    The ID of the engine cycle.

  • session_id - string
    The session ID of the engine cycle.

  • number - unsigned int
    The number of the engine cycle.

  • started_at - string (RFC 3339)
    The exact time when the engine cycle was started.

  • completed_at - string (RFC 3339)
    The exact time when the engine cycle was completed.

  • report - object
    The execution report of the engine cycle.

    • snapshot - object
      The active engine configuration’s snapshot that was used during the engine cycle.

      Active engine configuration properties are described in detail here.

    • symbols - map (string: object)
      The map of execution reports of all active symbols. Each symbol string is mapped to another map that contains all the strategies that were executed with the symbol. If interrupted boolean property is included in a strategy report and its value is true, other strategy report properties are omitted.

      Strategy report properties are described in detail here.

Multiple Engine Cycles Retrieval #

GET /engine/cycles

Retrieves multiple engine cycles.

Authentication required: yes

Permissions: engine-cycles-read

Query parameters:

  • limit - unsigned int
    The number of engine cycles per page.

  • page - unsigned int
    The engine cycle batch index.

  • omissions - array of strings (optional; default: unused)
    The array containing properties that are omitted from each returned engine cycle object. Possible values:

    • report
  • filter-session-id-eq - string (optional; default: unused)
    If specified, only engine cycles whose session IDs match this value are returned.

  • filter-number-eq - unsigned int (optional; default: unused)
    If specified, only engine cycles whose numbers match this value are returned.

    filter-number-eq should be used as the default search bar filter.

  • sort-{index}-started-at - string (enum; optional; default: unused)
    If specified, engine cycles are sorted by their start timestamps. The value determines whether ascending (asc) or descending (desc) order is used.

  • sort-{index}-completed-at - string (enum; optional; default: unused)
    If specified, engine cycles are sorted by their completion timestamps. The value determines whether ascending (asc) or descending (desc) order is used.

Many different filter- and sort- keys may be used at the same time, however, to ensure predictable sorting, sort- keys must include an index denoting their precendence. For example, if ?sort-1-completed-at=asc&sort-2-started-at=desc query is being used, engine cycles are first sorted by their completion and only then by their start timestamps.

Request body: none

Response body:

{
	"page_count": 300,
	"cycles": [
		{
			"id": "9bsv0s78ajk0036f3m60",
			"session_id": "38sv0s78ajk0036f3m60",
			"number": 300,
			"started_at": "2020-09-10T21:01:20Z",
			"completed_at": "2020-09-10T21:02:20Z",
			"report": {
				"snapshot": {
					"config": {
						"id": "12sv0s78ajk0036f3m60",
						"name": "engine1",
						"scheme": {
							"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"
											]
										}
									}
								}
							},
							"strategies": {
								"strategy1": {
									"candle_interval": "5mins",
									"timeout": "18m15s",
									"tools": [
										{
											"type": "placeholder",
											"permit": true
										}
									],
									"outcomes": [
										{
											"type": "placeholder"
										}
									]
								}
							}
						}
					},
					"session": {
						"symbols": {
							"ETH_BTC": {
								"enabled_at": "2020-10-10T21:01:20Z",
								"first_cycle": 30
							},
							"BTC_USDT": {
								"enabled_at": "2020-10-10T22:01:20Z",
								"first_cycle": 30
							}
						}
					}
				},
				"symbols": {
					"ETH_BTC": {
						"strategy1": {
							"tools": [
								{
									"type": "placeholder",
									"permit": true
								}
							],
							"outcomes": [
								{
									"type": "placeholder"
								}
							],
							"exchange": {
								"candles": [
									{
										"opened_at": "2020-09-10T21:01:20Z",
										"open": "2",
										"high": "3",
										"low": "4",
										"close": "5",
										"volume": "6"
									},
									{
										"opened_at": "2020-09-10T21:03:20Z",
										"open": "3",
										"high": "4",
										"low": "5",
										"close": "6",
										"volume": "7"
									}
								]
							}
						}
					},
					"BTC_USDT": {
						"strategy1": {
							"interrupted": true
						}
					}
				}
			}
		}
	]
}
  • page_count - unsigned int
    The number of available pages that may be retrieved with the same filtering options.

  • cycles - array of objects
    The array of engine cycles.

    Engine cycle properties are described in detail here.

Engine Cycle Count Retrieval #

GET /engine/cycles/count

Retrieves the total number of engine cycles.

Authentication required: yes

Permissions: engine-cycles-read

Query parameters: none

Request body: none

Response body:

{
	"count": 300
}
  • count - unsigned int
    The total number of engine cycles.