资源加载中... loading...

CommandRobot

The CommandRobot method is used to send an interaction command to the live trading under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The Id of the live trading receiving the interaction command is the live trading Id specified by the robotId parameter, and the interaction command is returned by the GetCommand() function called in the strategy to capture it.

{
    "code":0,
    "data":{
        "result":true,
        "error":null
    }
}
  • result: Whether the interactive command is sent successfully; when sending a command to a live trading that is not running, the result in the returned data is false.

The parameter robotId is used to specify the Id of the live trading that receives the interactive command. You can use the GetRobotList method to get the information of the live trading under the account, which contains the live trading Id.

robotId true number The parameter cmd is the interactive command sent to the bot; the command will be captured by the function GetCommand(), which triggers the interactive logic in the strategy. For specific implementation of the interaction logic in the strategy code, please refer to the GetCommand() function in the FMZ Quant Trading Platform API Manual.

cmd true string

Live trading strategy, assuming that this strategy is in operation, the live trading ID is 123:

function main() {
    while (true) {
        var cmd = GetCommand()
        if (cmd) {
            Log(cmd)
        }
        Sleep(2000)
    }
}

If we use the Python test script in this chapter, access the extended API of the FMZ Quant Trading Platform: api("CommandRobot", 123, "test command"). The live trading with ID 123 will receive the interactive command: test command, and then print it out through the Log function output.

GetRobotList StopRobot