Extended API Interface Details
All methods are called through https://www.fmz.com/api/v1; for the request format and signature see Authentication Methods → Signature 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 may be omitted) | 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 |
| Live trading | GetRobotGroupList | none | Live trading groups | Read-only |
| Live trading | GetRobotList | [offset, length, customStatus, appId, kw, groupId, orderBy, strategyId] | Live trading list | Read-only |
| Live trading | GetRobotDetail | robotId | Live trading details | Read-only |
| Live trading | GetRobotLogs | robotId, logMinId, …, summaryLimit[, logExchange, logKeyword, logTypes] | Logs, profit, chart and status bar data | Read-only |
| Live trading | NewRobot | settings | Create and start a live trading bot | Charges fees; the bot trades for real |
| Live trading | RestartRobot | robotId[, settings] | Start (restart) a live trading bot | Charges fees; the bot trades for real |
| Live trading | StopRobot | robotId | Stop a live trading bot | Does not close positions |
| Live trading | CommandRobot | robotId, cmd | Send an interactive command | The strategy may place orders on it |
| Live trading | DeleteRobot | robotId[, removeLog] | Delete a live trading bot | Deletes, cannot be undone |
| Debugging | PluginRun | settings | Run a piece of code on a docker | The code can place real orders |
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"]. - 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).
Live trading configuration (settings)
The settings parameter of NewRobot, RestartRobot and PluginRun is a JSON object; common fields:
| Field | Description |
|---|---|
| name | Name of the live trading bot. |
| strategy | Strategy ID, see GetStrategyList. RestartRobot cannot change a bot'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. |
| node | ID of the docker that runs the bot, see GetNodeList; omitted or -1 means automatic assignment. |
| group | Live trading group ID, see GetRobotGroupList. |
| appid | Custom label; GetRobotList can filter by it. |
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 bot 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.
GetAccount
The GetAccount method is used to retrieve account information for the FMZ Quant Trading Platform account corresponding to the API KEY in the request.
Returns
json
{
"code":0,
"data":{
"result":{
"balance":22944702436,
"concurrent":0,
"consumed":211092719653,
"email":"[email protected]",
"openai":false,
"settings":null,
"sns":{"wechat":true},
"uid":"105ea6e51bcc177926a10fdbb7e2a1d6",
"username":"abc"
},
"error":null
}
}
- balance: Account balance in USD, stored as an integer for precision; divide by 1e8 (10 to the power of 8) to get the actual value, 229.44702436 in this example.
- consumed: Total amount spent, same unit and conversion as
balance.
Arguments
No parameters
GetNodeList
The GetNodeList method returns the dockers available to the platform account of the API KEY in the request, including your own dockers and the platform's public dockers.
Returns
json
{
"code": 0,
"data": {
"result": {
"all": 1,
"nodes": [{
"build": "3.7",
"city": "...",
"created": "2024-11-08 09:21:08",
"date": "2024-11-08 16:37:16",
"forward": "...",
"guid": "...",
"host": "node.fmz.com:9902",
"id": 123,
"ip": "...",
"is_owner": true,
"loaded": 0,
"name": "MacBook-Pro-2.local",
"online": true,
"os": "darwin/amd64",
"peer": "...",
"public": 0,
"region": "...",
"tunnel": false,
"version": "...",
"wd": 0
}]
},
"error": null
}
}
Return value field descriptions (fields with obvious literal meanings are not elaborated):
- all: Total number of dockers (public dockers included).
- nodes: List of detailed information for docker nodes.
- build: Version number.
- city: City location.
- is_owner: true indicates private docker, false indicates public docker.
- loaded: Load amount, i.e., the number of currently running strategy instances.
- public: 0 indicates private docker, 1 indicates public docker.
- region: Geographic location.
- version: Detailed version information of the docker.
- wd: Offline alarm switch, 0 indicates not enabled.
One-click deployed dockers contain additional information, with related fields prefixed by ecs_ and unit_, recording information about the one-click deployed docker server (operator name, configuration, status, etc.), billing cycle, price, and other information, which will not be detailed here.
Arguments
| Name | Type | Required | Description |
offset | number | No | Paging offset, default 0. |
limit | number | No | Page size; omitted or less than or equal to 0 returns everything. |
DeleteNode
The DeleteNode method is used to delete a docker node under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The docker node ID to be deleted is specified by the nid parameter.
Returns
json
{
"code":0,
"data":{
"result":true,
"error":null
}
}
- result: Whether the associated docker program was successfully deleted.
Arguments
| Name | Type | Required | Description |
nid | number | Yes | The |
GetExchangeList
The GetExchangeList method is used to get the list of exchanges supported by the FMZ quantitative trading platform and their configuration information.
Returns
When the isSummary parameter is false, the returned data:
json
{
"code": 0,
"data": {
"result": {
"exchanges": [{
"category": "加密货币||Crypto",
"eid": "Futures_Binance",
"id": 74,
"logo": "/upload/asset/d8d84b23e573e9326b99.svg",
"meta": "[{\"desc\": \"Access Key\", \"qr\":\"apiKey\",\"required\": true, \"type\": \"string\", \"name\": \"AccessKey\", \"label\": \"Access Key\"}, {\"encrypt\": true, \"qr\":\"secretKey\",\"name\": \"SecretKey\", \"required\": true, \"label\": \"Secret Key\", \"type\": \"password\", \"desc\": \"Secret Key\"}]",
"name": "币安期货|Futures_Binance",
"priority": 200,
"stocks": "BTC_USDT,ETH_USDT,ETH_USD",
"website": "https://accounts.binance.com/zh-TC/register?ref=45110270"
}]
},
"error": null
}
}
When the isSummary parameter is true, the returned data:
json
{
"code": 0,
"data": {
"result": {
"exchanges": [{
"category": "加密货币||Crypto",
"eid": "Futures_Binance",
"id": 74,
"logo": "/upload/asset/d8d84b23e573e9326b99.svg",
"name": "币安期货|Futures_Binance",
"priority": 200,
"website": "https://accounts.binance.com/zh-TC/register?ref=45110270"
}]
},
"error": null
}
}
- meta: Exchange configuration metadata.
Arguments
| Name | Type | Required | Description |
isSummary | bool | Yes | The |
GetPlatformList
The GetPlatformList method is used to get the list of configured exchanges under the FMZ Quant Trading Platform account corresponding to the API KEY in the request.
Returns
json
{
"code": 0,
"data": {
"result": {
"all": 2,
"platforms": [{
"category": "加密货币||Crypto",
"date": "2023-12-07 13:44:52",
"eid": "Binance",
"id": 123,
"label": "币安",
"logo": "...",
"name": "币安现货|Binance",
"stocks": ["BTC_USDT", "LTC_USDT", "ETH_USDT", "ETC_USDT", "BTC_TUSD", "ETH_TUSD", "BNB_TUSD"],
"website": "..."
}, {
"category": "通用协议|Custom Protocol",
"date": "2020-11-09 11:23:48",
"eid": "Exchange",
"id": 123,
"label": "XX交易所REST协议",
"logo": "...",
"name": "通用协议|Custom Protocol",
"stocks": ["BTC_USDT", "ETH_USDT"],
"website": ""
}]
},
"error": null
}
}
- all: Total number of configured exchange objects.
- platforms: Exchange related information.
- eid: Exchange identifier on the FMZ Quant Trading Platform,
eidis required in certain configurations and parameters.
- eid: Exchange identifier on the FMZ Quant Trading Platform,
Arguments
| Name | Type | Required | Description |
offset | number | No | Paging offset, default 0. |
limit | number | No | Page size; omitted or less than or equal to 0 returns everything. |
GetStrategyList
The GetStrategyList method is used to retrieve platform strategy information.
Returns
json
{
"code": 0,
"data": {
"result": {
"all": 123,
"strategies": [{
"category": 9,
"date": "2024-11-10 20:40:04",
"description": "",
"forked": 0,
"hits": 0,
"id": 123,
"is_buy": false,
"is_owner": false,
"language": 0,
"last_modified": "2024-11-11 17:23:52",
"name": "HedgeGridStrategy",
"profile": {
"avatar": "...",
"nickname": "abc",
"uid": "4ed225440db1eda23fe05ed10184113e"
},
"public": 0,
"tags": "",
"uid": "4ed225440db1eda23fe05ed10184113e",
"username": "abc"
}]
},
"error": null
}
}
- all: Total number of strategies matching the filter criteria.
- strategies: Detailed information of the strategies found;
categoryandlanguagetake the values described in the parameters above.
Arguments
| Name | Type | Required | Description |
offset | number | Yes | Paging offset. |
length | number | Yes | Page size; less than or equal to 0 returns everything. |
strategyType | number | Yes | Scope of the query:
|
category | number | Yes | Strategy type:
|
language | number | Yes | Programming language of the strategy:
|
kw | string | Yes | Keywords matched against strategy names, separated by spaces; an empty string means no filter. Starting with |
groupId | number | No | Strategy group: |
orderBy | string | No | Sort field: |
Remarks
There is no needArgs parameter. Passing an extra parameter after category, as older documentation did, shifts all following parameters; pass them in the order above, or by name:
plaintext
api('GetStrategyList', 0, 10, -3, -1, -1, '') # first 10 of your own strategies
api('GetStrategyList', strategyType=-3, language=7) # all of your own Rust strategies
GetRobotGroupList
The GetRobotGroupList method is used to get the list of live trading groups under the FMZ Quant Trading Platform account corresponding to the API KEY in the request.
Returns
json
{
"code": 0,
"data": {
"result": {
"items": [{
"id": 3417,
"name": "Test"
}, {
"id": 3608,
"name": "Live Trading Demo"
}]
},
"error": null
}
}
- items: Live trading group information.
- id: Live trading group ID.
- name: Live trading group name.
The items field only records newly created groups, the "Default" group is not included in items.
Arguments
No parameters
GetRobotList
The GetRobotList method returns the live trading bots of the platform account of the API KEY in the request. All parameters are optional.
Returns
json
{
"code": 0,
"data": {
"result": {
"all": 1,
"concurrent": 0,
"robots": [{
"charge_time": 1731654846,
"date": "2024-11-12 14:05:29",
"end_time": "2024-11-15 14:56:32",
"fixed_id": 4509153,
"id": 591026,
"is_sandbox": 0,
"name": "Test",
"node_guid": "45891bcf3d57f99b08a43dff76ee1ea1",
"node_id": 4519153,
"node_public": 0,
"profit": 0,
"public": 0,
"refresh": 1731651257000,
"start_time": "2024-11-15 14:56:30",
"status": 3,
"strategy_id": 411670,
"strategy_isowner": true,
"strategy_language": 0,
"strategy_name": "Test",
"strategy_public": 0,
"uid": "105ed6e511cc977921610fdbb7e2a1d6",
"wd": 0
}]
},
"error": null
}
}
- all: Total number of bots matching the filters.
- robots: Live trading bot information;
statusis the live trading status code.- group_id: Live trading bot group ID; if the live trading bot is in the default group, the
group_idfield is not included.
- group_id: Live trading bot group ID; if the live trading bot is in the default group, the
Arguments
| Name | Type | Required | Description |
offset | number | No | Paging offset, default 0. |
length | number | No | Page size; less than or equal to 0 returns everything (default). |
customStatus | number | No | Filter by live trading status code, see Live Trading Status Codes; |
appId | string | No | Filter by the bot's custom label ( |
kw | string | No | Keyword matched against bot names; an empty string means no filter. |
groupId | number | No | Live trading group: |
orderBy | string | No | Sort field: |
strategyId | number | No | When greater than 0, only bots of this strategy are returned; default 0 (no filter). |
Remarks
Using api() from the Python example on the signature authentication page:
api('GetRobotList'): all live trading bots.api('GetRobotList', 'member2'): a single string is taken as the label; all bots labeled member2.api('GetRobotList', 0, 100, -1, 'member2', ''): positional parameters; up to 100 bots labeled member2, starting at offset 0.api('GetRobotList', appId='member2', length=100): the same by parameter name.
GetRobotDetail
The GetRobotDetail method is used to get detailed information of a live trading bot under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The detailed information of the live trading bot to be retrieved is specified by the robotId parameter.
Returns
json
{
"code": 0,
"data": {
"result": {
"robot": {
"charge_time": 1732246539,
"charged": 5850000,
"consumed": 5375000000,
"date": "2018-12-28 14:34:51",
"favorite": {
"added": false,
"type": "R"
},
"fixed_id": 123,
"hits": 1,
"id": 123,
"is_deleted": 0,
"is_manager": true,
"is_sandbox": 0,
"name": "Test",
"node_id": 123,
"pexchanges": {
"123": "Futures_OKX"
},
"phash": {
"123": "ca1aca74b9cf7d8624f2af2dac01e36d"
},
"plabels": {
"123": "OKX Futures"
},
"priority": 0,
"profit": 0,
"public": 0,
"refresh": 1732244453000,
"robot_args": "[]",
"start_time": "2024-11-22 11:00:48",
"status": 1,
"strategy_args": "[]",
"strategy_exchange_pairs": "[60,[123],[\"ETH_USDT\"]]",
"strategy_id": 123,
"strategy_last_modified": "2024-11-21 16:49:25",
"strategy_name": "Test",
"strategy_public": "0",
"uid": "105ed6e51bcc17792a610fdbb7e2a1d6",
"username": "abc",
"wd": 0
}
},
"error": null
}
}
- charge_time: Next billing time (Unix timestamp in seconds), i.e. the end of the period already paid for.
- charged: Total billed time in seconds.
- consumed: Total amount charged in USD, stored as an integer scaled by 1e8; 5375000000 in the example is 53.75 USD.
- date: Creation date.
- fixed_id: Docker ID assigned during live trading. If auto-assigned, this value is -1.
- is_manager: Whether has permission to manage this live trading bot.
- is_sandbox: Whether it is a simulated trading bot.
- name: Live trading bot name.
- node_id: Docker ID.
- pexchanges: Exchange objects configured for the live trading bot, where 123 is the pid and "Futures_OKX" is the exchange ID (eid).
- plabels: Label information for the exchange objects configured for the live trading bot.
- profit: Live trading bot profit data.
- public: Whether the live trading bot is public.
- refresh: Last active time.
- strategy_exchange_pairs: Configured exchange objects and their trading pair information.
- wd: Whether offline alert is enabled.
Arguments
| Name | Type | Required | Description |
robotId | number | Yes | The |
Remarks
Explanation of the strategy_exchange_pairs attribute, using the following data as an example:
plaintext
"[60,[44314,42960,15445,14703],[\"BTC_USDT\",\"BTC_USDT\",\"ETH_USDT\",\"ETH_USDT\"]]"
The first data 60 indicates that the default K-line period set for the live trading bot is 1 minute, i.e., 60 seconds.
[44314,42960,15445,14703] are the pid values of the exchange objects configured for the live trading bot (arranged in the order they were added).
[\"BTC_USDT\",\"BTC_USDT\",\"ETH_USDT\",\"ETH_USDT\"] are the trading pairs set for the exchange objects configured for the live trading bot (corresponding one-to-one with the pid values in the order they were added).
GetRobotLogs
The GetRobotLogs method is used to get the live trading log information under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The live trading ID for which to get log information is specified by the robotId parameter.
Returns
json
{
"code": 0,
"data": {
"result": {
"chart": "",
"chartTime": 0,
"logs": [{
"Total": 20,
"Max": 20,
"Min": 1,
"Arr": []
}, {
"Total": 0,
"Max": 0,
"Min": 0,
"Arr": []
}, {
"Total": 0,
"Max": 0,
"Min": 0,
"Arr": []
}],
"node_id": 123,
"online": true,
"refresh": 1732201544000,
"status": 4,
"summary": "...",
"updateTime": 1732201532636,
"wd": 0
},
"error": null
}
}
- logs: Log information; the queried log data entries are stored in the Arr field.
The first data structure in logs contains log records from the strategy log table in the live trading database.
The second data structure in logs contains log records from the profit log table in the live trading database.
The third data structure in logs contains log records from the chart log table in the live trading database. - summary: Live trading status bar data.
Arguments
| Name | Type | Required | Description |
robotId | number | Yes | The |
logMinId | number | Yes | The |
logMaxId | number | Yes | The |
logOffset | number | Yes | The |
logLimit | number | Yes | The |
profitMinId | number | Yes | The |
profitMaxId | number | Yes | The |
profitOffset | number | Yes | The |
profitLimit | number | Yes | The |
chartMinId | number | Yes | The |
chartMaxId | number | Yes | The |
chartOffset | number | Yes | The |
chartLimit | number | Yes | The |
chartUpdateBaseId | number | Yes | The |
chartUpdateDate | number | Yes | The |
summaryLimit | number | Yes | The Setting it to 0 means not querying status bar information; setting it to a non-zero value indicates the number of bytes of status bar information to query (this interface does not limit the amount of data, you can specify a larger summaryLimit parameter to get all status bar information). The status bar data is stored in the |
logExchange | string | No | Only logs of this exchange object (by label); an empty string means no filter. |
logKeyword | string | No | Only logs whose content contains this keyword; an empty string means no filter. |
logTypes | string | No | Only logs of these types, as comma-separated log type numbers, e.g. |
Remarks
-
Strategy log table in database
The description of theArrattribute value in the first element (log data) of thelogsattribute value (array structure) in the returned data is as follows:plaintext"Arr": [ [3977, 3, "Futures_OKX", "", 0, 0, "Sell(688.9, 2): 20016", 1526954372591, "", ""], [3976, 5, "", "", 0, 0, "this_week Position too large, long: 2", 1526954372410, "", ""] ],id logType eid orderId price amount extra date contractType direction 3977 3 "Futures_OKX" "" 0 0 "Sell(688.9, 2): 20016" 1526954372591 "" "" 3976 5 "" "" 0 0 "this_week Position too large, long: 2" 1526954372410 "" "" extrais the additional information for the printed log.The log type descriptions corresponding to
logTypevalues are as follows:logType: 0 1 2 3 4 5 6 logType meaning: BUY SALE RETRACT ERROR PROFIT MESSAGE RESTART English meaning Buy order log Sell order log Cancel order Error Profit Message Restart -
Profit chart log table in database
The data in this chart log table is consistent with the profit logs in the strategy log table.plaintext"Arr": [ [202, 2515.44, 1575896700315], [201, 1415.44, 1575896341568] ]Taking one log data as an example:
plaintext[202, 2515.44, 1575896700315]202is the log ID,2515.44is the profit value,1575896700315is the timestamp. -
Chart log table in database
plaintext"Arr": [ [23637, 0, "{\"close\":648,\"high\":650.5,\"low\":647,\"open\":650,\"x\":1575960300000}"], [23636, 5, "{\"x\":1575960300000,\"y\":3.0735}"] ]Taking one log data as an example:
plaintext[23637, 0, "{\"close\":648,\"high\":650.5,\"low\":647,\"open\":650,\"x\":1575960300000}"],23637is the log ID,0is the chart data series index, and the final data"{\"close\":648,\"high\":650.5,\"low\":647,\"open\":650,\"x\":1575960300000}"is the log data, which is the K-line data on the chart.
NewRobot
The NewRobot method creates a live trading bot under the platform account of the API KEY in the request and starts it; like creating a bot on the website, this charges fees.
Returns
json
{
"code":0,
"data":{
"result":591988,
"error":null
}
}
- result: The ID of the new bot on success; a negative number on failure, with the meaning of the abnormal codes in Live Trading Status Codes (e.g.
-2no docker found,-5insufficient balance).
Arguments
| Name | Type | Required | Description |
settings | JSON object | Yes | Live trading configuration; for its fields see "Live trading configuration (settings)" in Extended API Interface Details. For example:
|
Remarks
When the exchange configuration is passed directly with eid, the platform does not store the keys in meta, so every later RestartRobot of this bot must pass settings again.
RestartRobot
The RestartRobot method starts (restarts) a live trading bot of the platform account of the API KEY in the request; the bot is given by robotId. Starting a bot charges fees.
Returns
json
{
"code":0,
"data":{
"result":1,
"error":null
}
}
- result: Live trading status code, 1 indicates running.
Arguments
| Name | Type | Required | Description |
robotId | number | Yes | Live trading bot ID, see the |
settings | JSON object | No | Live trading configuration; for its fields see "Live trading configuration (settings)" in Extended API Interface Details. When given, the bot's configuration (name, parameters, exchanges, K-line period, docker, group) is updated with it before starting; the strategy cannot be changed. |
Remarks
A bot created on the website with exchange accounts referenced by pid can be started with robotId alone, using its current configuration. A bot whose exchanges were passed directly with eid (usually created through the extended API) has no stored keys, so settings must be passed on every restart.
StopRobot
The StopRobot method is used to stop a live trading bot under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The bot Id to be stopped is specified by the robotId parameter.
Returns
json
{
"code":0,
"data":{
"result":2,
"error":null
}
}
- result: Bot status code, 2 indicates stopping.
Arguments
| Name | Type | Required | Description |
robotId | number | Yes | The |
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 interactive command sent to the bot; the strategy reads it with |
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)
}
}
Calling api("CommandRobot", 123, "test command") with api() from the Python example on the signature authentication page, the bot with Id 123 will receive the interactive command: test command, and output it through the Log function.
DeleteRobot
The DeleteRobot method deletes a live trading bot of the platform account of the API KEY in the request; the bot is given by robotId. A running bot must be stopped first. Deletion cannot be undone.
Returns
json
{
"code":0,
"data":{
"result":0,
"error":null
}
}
- result: Result of the deletion.
- 0: deleted.
- -1: not deleted: the bot does not exist, or it is still running, starting or stopping.
- -2: the bot was deleted, but its docker could not be reached, so the log data was not removed; delete it manually under
logs/storage/<bot ID>/in the docker's directory (e.g.123.db3).
Arguments
| Name | Type | Required | Description |
robotId | number | Yes | ID of the bot to delete, see the |
removeLog | bool | No | Whether to delete the bot's log data on the docker as well; default |
PluginRun
The PluginRun method runs a piece of JavaScript code on a docker and returns the result. It uses the same execution mechanism as the "Debug Tool" among the development tools and trading terminal plugins (see Integrations → Trading Terminal → Plugin Principle and Development). No live trading bot is created and nothing is charged; one run lasts at most 5 minutes.
Returns
json
{
"code": 0,
"data": {
"result": "{\"logs\":[{\"PlatformId\":\"\",\"OrderId\":\"0\",\"LogType\":5,\"Price\":0,\"Amount\":0,\"Extra\":\"Hello FMZ\",\"Currency\":\"\",\"Instrument\":\"\",\"Direction\":\"\",\"Time\":1732267473108}],\"result\":\"\"}",
"error": null
}
}
- result: The result as a JSON string:
logsholds the logs written withLog(),resultthe JSON text of the value returned bymain().
Arguments
| Name | Type | Required | Description |
settings | JSON object | Yes | Run configuration, for example:
|
Remarks
exchanges can also pass the exchange configuration directly instead of referencing an exchange account on the platform, for example:
plaintext
{"eid": "Binance", "pair": "ETH_BTC", "meta": {"AccessKey": "...", "SecretKey": "..."}}
The field names of meta are given by the meta returned by GetExchangeList. Usually only one exchange object is set in exchanges (the debug tool page also supports only one); setting two causes no error, but accessing the second exchange object in the code does.