NewRobot
Creates a robot in the account and starts it; like creating a robot on the website, this charges fees and the robot trades for real.
Examples
Create and start a robot with an added exchange account (pid).
python
# api() is the function in the Python example on the signature authentication page
settings = {
"name": "test",
"strategy": 123,
"args": [],
"exchanges": [
{"pid": 123, "pair": "SOL_USDT"}
],
"period": 60,
"node": 123,
"group": 123,
"appid": "test"
}
r = api('NewRobot', settings)
print(r['data']['result']) # output: 591988 (ID of the new robot)Returns
| Type | Description |
number |
|
Arguments
| Name | Type | Required | Description |
settings | object | Yes | Robot configuration; fields are described under "Robot configuration (settings)" in |
Remarks
When created through the extended API, the call returns after the start-up has run. If start-up fails (e.g. the strategy does not compile), the ID of the new robot is still returned and the robot is in the "strategy error" state (status code 5), so check its status with GetRobotDetail after creating it.
A negative result means no robot was created; see "Return values of failed starts" in Live Trading Status Codes, e.g. -2 no docker found, -5 insufficient balance. When the account exceeds the number of robots it may run, an error with code 6 is returned.
When an exchange configuration is passed directly with eid, the platform does not store the keys in meta, so every later restart of the robot with RestartRobot must pass settings again.