CommandRobot
Sends an interactive command to a running robot of the account; the strategy receives it with GetCommand.
Examples
Send the command test command to running robot 123; its strategy receives it with GetCommand() and logs it (strategy code in the remarks).
python
# api() is the function in the Python example on the signature authentication page
r = api('CommandRobot', 123, 'test command')
print(r['data']['result']) # output: TrueReturns
| Type | Description |
bool |
|
Arguments
| Name | Type | Required | Description |
robotId | number | Yes | ID of the robot that receives the command; see |
cmd | string | Yes | The interactive command; the strategy reads it with |
Remarks
A strategy that receives the command:
javascript
// strategy run by robot 123: print each interactive command it receives
function main() {
while (true) {
var cmd = GetCommand()
if (cmd) {
Log(cmd)
}
Sleep(2000)
}
}
To call CommandRobot from a webhook that accepts only one URL, such as TradingView, see Direct Verification.