CommandRobot
The CommandRobot method is used to send interactive commands to a live trading bot under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The bot Id that receives the interactive command is specified by the robotId parameter, and the interactive command is captured and returned by the GetCommand() function called in the strategy.
Returns
json
{
"code":0,
"data":{
"result":true,
"error":null
}
}
- result: Whether the interactive command was sent successfully. When sending a command to a bot that is not running, the result in the returned data will be false.
Arguments
| Name | Type | Required | Description |
robotId | number | Yes | The |
cmd | string | Yes | The |
Remarks
Example of bot strategy (assuming this strategy bot is running with bot Id 123):
javascript
function main() {
while (true) {
var cmd = GetCommand()
if (cmd) {
Log(cmd)
}
Sleep(2000)
}
}
If you use the Python test script in this section to access the FMZ Quant Trading Platform's extended API: api("CommandRobot", 123, "test command"), the bot with Id 123 will receive the interactive command: test command, and output it through the Log function.