Extended API Interface Details
All methods are called through https://www.fmz.com/api/v1; for the request format and signature see Token Authentication, for the response structure and error codes see Extended API Interface Return Codes. The api() used in the examples on the method pages is the function from the Python example on the signature authentication page.
Method overview
| Object | Method | Parameters (in order; bracketed ones are optional) | Description | Notes |
|---|---|---|---|---|
| Account | GetAccount | none | Account information | Read-only |
| Docker | GetNodeList | [offset, limit] | Docker list | Read-only |
| Docker | DeleteNode | nid | Delete a docker | Deletes, cannot be undone |
| Exchange | GetExchangeList | isSummary | Exchanges supported by the platform and their settings | Read-only |
| Exchange | GetPlatformList | [offset, limit] | Exchange accounts you added | Read-only |
| Strategy | GetStrategyList | offset, length, strategyType, category, language, kw[, groupId, orderBy] | Strategy list | Read-only |
| Robot | GetRobotGroupList | none | Robot groups | Read-only |
| Robot | GetRobotList | [offset, length, customStatus, appId, kw, groupId, orderBy, strategyId] | Robot list | Read-only |
| Robot | GetRobotDetail | robotId | Robot details | Read-only |
| Robot | GetRobotLogs | robotId, logMinId, …, summaryLimit[, logExchange, logKeyword, logTypes] | Logs, profit, chart and status bar data | Read-only |
| Robot | NewRobot | settings | Create and start a robot | Charges fees; the robot trades for real |
| Robot | RestartRobot | robotId[, settings] | Start (restart) a robot | Charges fees; the robot trades for real |
| Robot | StopRobot | robotId | Stop a robot | Does not close positions |
| Robot | CommandRobot | robotId, cmd | Send an interactive command | The strategy may place orders on it |
| Robot | DeleteRobot | robotId[, removeLog] | Delete a robot | Deletes, cannot be undone |
| Debugging | PluginRun | settings | Run a piece of code on a docker | The code can place real orders |
| Channel | pub | robot, channel (URL parameters); the message goes in the request body | Push a message to a channel a robot subscribed to | No API key, no signature |
The API key needs permission for the method, see Create ApiKey.
Passing parameters
args can be written in two ways:
- Array: positional parameters in the order of the table above, e.g.
[123, "ok"]. Positional calls accept only certain numbers of arguments; any other count returns aParams number mismatcherror:- GetNodeList, GetPlatformList: 0 or 2.
- GetStrategyList: 0, 6, 7 or 8; with no arguments
languageis1(only Python strategies), seeGetStrategyList. - GetRobotList: 0, 1, 3, 5, 6, 7 or 8; a single argument is taken as
appId. - GetRobotLogs: 15 to 19 (with 15 the status bar is not queried).
- RestartRobot, DeleteRobot: 1 or 2; when DeleteRobot gets only
robotId,removeLogisfalse.
- Object: values by parameter name, e.g.
{"robotId": 123, "cmd": "ok"}. Names are case-insensitive and underscores are ignored; omitted parameters take their defaults. Recommended for methods with many optional parameters (GetRobotList, GetRobotLogs, GetStrategyList).
Robot configuration (settings)
The settings parameter of NewRobot, RestartRobot and PluginRun is a JSON object; common fields:
| Field | Description |
|---|---|
| name | Robot name. |
| strategy | Strategy ID, see GetStrategyList. RestartRobot cannot change a robot's strategy. |
| args | Strategy parameters, each element ["name", value], e.g. [["Interval", 500]]; [] if the strategy has none. |
| exchanges | Array of exchange object configurations, one element per exchange object, see below. |
| period | Default K-line period in seconds, e.g. 60, 3600; 60 seconds when omitted. Pass 60 or more; see below the table. |
| node | ID of the docker that runs the robot, see GetNodeList; omitted or -1 means automatic assignment. |
| group | Robot group ID, see GetRobotGroupList. |
| appid | Custom label; GetRobotList can filter by it. |
A period of 0, 1, 2, 3, 4, 5, 10 or 12 is read as an old period number (1 minute, 3 minutes, 5 minutes, 15 minutes, 30 minutes, 1 hour, 1 day, 1 week respectively); for example 1 actually means 180 seconds.
An exchanges element takes one of two forms, which cannot be mixed in one array (the first element decides):
- Reference an exchange account added on the platform:
{"pid": 123, "pair": "BTC_USDT"}.pidis theidreturned by GetPlatformList. - Pass the exchange configuration directly:
{"eid": "Binance", "label": "test", "pair": "BTC_USDT", "meta": {"AccessKey": "...", "SecretKey": "..."}}.eidis the exchange ID; the field names ofmetaare given by themetareturned by GetExchangeList;labelis the exchange object's label, read in the strategy withexchange.GetLabel(). The platform does not store the keys inmetabut forwards them to the docker, so a robot created this way needssettingsagain on every restart.
For a custom-protocol exchange: {"eid": "Exchange", "label": "test", "pair": "BTC_USDT", "meta": {"AccessKey": "...", "SecretKey": "...", "Front": "http://127.0.0.1:6666/test"}}, where Front is the address of the custom-protocol service.
In this sectionRead the whole section
| Name | Description |
| GetAccount | Gets the account information of the account that owns the API key, including the balance and the total amount spent. |
| GetNodeList | Gets the dockers the account can use, including its own dockers and the platform's public dockers. |
| DeleteNode | Deletes a docker of the account; an online docker is forced to log out and all robots on it become "strategy error". |
| GetExchangeList | Gets the exchanges the platform supports and the configuration fields each of them needs. |
| GetPlatformList | Gets the exchange accounts added to the account. |
| GetStrategyList | Queries strategies by scope, type, language, keyword and other conditions. |
| GetRobotGroupList | Gets the robot groups of the account; the "Default" group is not listed. |
| GetRobotList | Gets the robots of the account, optionally filtered by status, label, name, group or strategy; all arguments can be omitted. |
| GetRobotDetail | Gets the details of one robot of the account, including its status, billing, exchange configuration and strategy arguments. |
| GetRobotLogs | Gets the strategy log, profit log, chart data and status bar data of one robot of the account. |
| 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. |
| RestartRobot | Starts (restarts) a robot of the account, optionally replacing its configuration; starting charges fees. |
| StopRobot | Stops a robot of the account; stopping does not close positions. |
| CommandRobot | Sends an interactive command to a running robot of the account; the strategy receives it with GetCommand. |
| DeleteRobot | Deletes a robot of the account; a running robot must be stopped first, and deletion cannot be undone. |
| PluginRun | Runs a piece of JavaScript code on a docker and returns the result, without creating a robot or charging fees; one run lasts at most 5 minutes, and the code can… |
| pub | Pushes a message to a channel subscribed by a running robot, so that systems outside the platform (TradingView webhook alerts, your own trading system, monitori… |