Type/to search
Getting Started
Platform Basics
Writing Strategies
Development Tools
Backtesting System
Advanced Topics
Data and Research
Extended API Interface
AI Integration
Create ApiKey
Authentication Methods
Extended API Interface Details
GetAccount
GetNodeList
DeleteNode
GetExchangeList
GetPlatformList
GetStrategyList
GetRobotGroupList
GetRobotList
GetRobotDetail
GetRobotLogs
NewRobot
RestartRobot
StopRobot
CommandRobot
DeleteRobot
PluginRun
pub
Extended API Interface Return Codes
Live Trading Status Codes

Starts (restarts) a robot of the account, optionally replacing its configuration; starting charges fees.

Examples

Start robot 123 with its current configuration.

python
# api() is the function in the Python example on the signature authentication page r = api('RestartRobot', 123) print(r['data']['result']) # output: 0 (preparing; the start-up has run)

Returns

TypeDescription

number

data.result: normally 0 (preparing), meaning the start-up has run; whether the start succeeded must be checked with GetRobotDetail. Other return values are in the remarks.

Arguments

NameTypeRequiredDescription

robotId

number

Yes

Robot ID; see GetRobotList.

settings

object

No

New robot configuration; when given it replaces the whole configuration before starting, see the remarks. Fields are described under "Robot configuration (settings)" in Extended API Interface Details.

Remarks

A robot created on the website with added exchange accounts (pid) can be started with just robotId, using its current configuration. A robot whose exchange configurations were passed directly with eid (usually created through the extended API) has no stored keys, so settings must be passed on every restart.

When settings is given, it replaces the robot's whole configuration (name, arguments, exchanges, K-line period, docker) before the start; the strategy cannot be changed. Fields left out do not keep their old values: name becomes an empty string, args becomes [] (all arguments back to their defaults), leaving out exchanges deletes all of the robot's exchange configurations, period becomes 60 seconds and node becomes automatic; only group keeps the old group when omitted or 0. So always pass a complete configuration; it is best to get the current one with GetRobotDetail and modify it.

Passing settings while the robot is preparing, running or stopping returns an error with code 6 (robot is running); without settings the robot is not restarted and its current status code (0, 1 or 2) is returned.

A negative result means the start failed; see "Return values of failed starts" in Live Trading Status Codes. Whether the robot is then running, or in "strategy error" because it failed to compile, must be checked with GetRobotDetail.