Type/to search
Welcome to FMZ Quant Trading Platform
Programming Languages
JavaScript
TypeScript
Python
C++
MyLanguage
PINE Language
Blockly Visual Programming
Workflow
Key Security
Live Trading
Strategy Library
Docker
Deploy Docker
One-Click Docker Rental
Manual Deployment of Bot
Docker Operation Precautions
Global IP Address Specification
Command Line Parameters for Bot Program
Live Trading Data Migration
Docker Monitor
Exchange
Strategy Editor
Backtesting System
Strategy Entry Functions
Strategy Framework and API Functions
Template Library
Strategy Parameters
Interactive Controls
Options Trading
C++ Strategy Writing Guide
JavaScript Strategy Writing Guide
Web3
Built-in Libraries
Extended API Interface
MCP Service
Trading Terminal
Data Explorer
Alpha Factor Analysis Tool
General Protocol
Debugging Tool
Remote Editing
Import and Export of Complete Strategies
Multi-language Support
Live Trading and Strategy Grouping
Live Trading Display
Strategy Sharing and Renting
Live Trading Message Push
Common Causes of Live Trading Errors and Abnormal Exits
Exchange-Specific Notes

  • FMZ Quant Trading Platform Extended API Interface
    Append query parameters directly after https://www.fmz.com/api/v1 (separated by ?). Below are the request parameters expressed in Python:

    json
    { "version" : "1.0", "access_key": "xxx", "method" : "GetNodeList", "args" : [], "nonce" : 1516292399361, "sign" : "085b63456c93hfb243a757366600f9c2" }
    FieldDescription
    versionVersion number.
    access_keyAccessKey, apply on the account management page.
    methodThe specific method to call.
    argsParameter list for calling the method.
    nonceTimestamp in milliseconds, allowing a 1-hour deviation from standard timestamp. The nonce must be greater than the nonce value from the previous access.
    signSignature.

    Parameters are separated by &, parameter names and values are connected by =. Complete request URL (using method=GetNodeList as an example):

    plaintext
    https://www.fmz.com/api/v1?access_key=xxx&nonce=1516292399361&args=%5B%5D&sign=085b63456c93hfb243a757366600f9c2&version=1.0&method=GetNodeList

    Note: The request parameters do not include the secret_key parameter.

  • Signature Method
    The encryption method for the sign parameter in the request is as follows, formatted as:

    plaintext
    version + "|" + method + "|" + args + "|" + nonce + "|" + secretKey

    After concatenating the string, use the MD5 encryption algorithm to encrypt the string and convert it to a hexadecimal string. This value is used as the value of the sign parameter. For the signature part, refer to the Python code Extended API Interface "Authentication Method":

    python
    # Parameters d = { 'version': '1.0', 'access_key': accessKey, 'method': method, 'args': json.dumps(list(args)), 'nonce': int(time.time() * 1000), } # Calculate sign signature d['sign'] = md5.md5(('%s|%s|%s|%d|%s' % (d['version'], d['method'], d['args'], d['nonce'], secretKey)).encode('utf-8')).hexdigest()
  • Interface Business Errors:

    • Insufficient parameters:
      json
      { "code":0, "data":{ "result":null, "error":"Params length incorrect" } }

The GetNodeList method is used to retrieve the list of docker nodes under the FMZ Quant Trading Platform account corresponding to the API KEY in the request.

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 docker nodes associated with the current account.
  • 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

No parameters

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

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, eid is required in certain configurations and parameters.

Arguments

No parameters

The GetRobotList method is used to get the list of live trading bots under the FMZ Quant Trading Platform account corresponding to the API KEY in the request.

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 } }
  • robots: Live trading bot information
    • group_id: Live trading bot group ID; if the live trading bot is in the default group, the group_id field is not included.

Arguments

NameTypeRequiredDescription

offset

number

No

Offset setting for pagination query.

length

number

No

Data length setting for pagination query.

robotStatus

number

No

Specify the status of live trading bots to query, refer to Extended API Interface "Live Trading Status Codes", pass -1 to get all live trading bots.

label

string

No

Specify the custom label of live trading bots to query, can filter all live trading bots containing this label.

keyWord

string

No

Query keyword.

Remarks

Taking the Extended API Interface "Authentication Method" in Python language as an example:

print(api('GetRobotList')): Get all live trading bot information.

print(api('GetRobotList', 'member2')): Print all live trading bot information with custom label member2.

print(api('GetRobotList', 0, 5, -1, 'member2')): Pagination query, starting from offset 0, returning at most 5 live trading bots with label member2.

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

NameTypeRequiredDescription

robotId

number

Yes

The robotId parameter is used to specify the bot Id that receives the interactive command. You can use the GetRobotList method to get information about bots under the account, which includes the bot Id.

cmd

string

Yes

The cmd parameter is the interactive command sent to the bot. The GetCommand() function in the bot strategy will capture this interactive command and trigger the strategy's interaction logic. For the specific implementation of interaction logic in the strategy code, please refer to the GetCommand() function description in the FMZ Quant Trading Platform API Manual.

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.

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

NameTypeRequiredDescription

robotId

number

Yes

The robotId parameter is used to specify the bot Id to be stopped. You can obtain the bot information under the account through the GetRobotList method, which includes the bot Id.

The RestartRobot method is used to restart a live trading bot under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The bot ID to be restarted is specified by the robotId parameter.

Returns

json
{ "code":0, "data":{ "result":1, "error":null } }
  • result: Live trading status code, 1 indicates running.

Arguments

NameTypeRequiredDescription

robotId

number

Yes

The robotId parameter is used to specify the ID of the live trading bot to be restarted. You can use the GetRobotList method to get information about live trading bots under the account, which includes the bot ID.

settings

JSON object

No

Live trading configuration parameters. The settings parameter format is as follows:

json
{ "appid":"test", "args":[], "exchanges":[ {"pair":"SOL_USDT","pid":123}, {"pair":"ETH_USDT","pid":456} ], "name":"Test", "node":123, "period":60, "strategy":123 }
  • appid: Custom field
    Can be used to define labels.
  • args: Strategy parameter settings
    Structure is an array, with each element being a parameter. For example, if the strategy has a parameter Interval and you want to set Interval to 500 when restarting the strategy, args should contain: ["Interval", 500], i.e.: "args": [["Interval", 500]].
  • exchanges: Exchange object configuration bound to the live trading bot
    Structure is an array, where each element is an exchange object configuration.
    • Can bind exchange objects already configured on the platform
      Using pid configuration: {"pair":"SOL_USDT","pid":123}; pid can be queried through the GetPlatformList interface, where the id field in the returned data is the exchange pid.
    • Can directly pass configuration information to bind exchange objects
      Using eid configuration: {"eid":"Huobi","label":"test Huobi","meta":{"AccessKey":"123","SecretKey":"123"},"pair":"BCH_BTC"}; Sensitive information such as the passed API KEY will not be stored by the FMZ Quant Trading Platform, and this data will be directly forwarded to the docker program. If using this type of configuration, this information must be configured each time creating or restarting a live trading bot.
    • Can bind General Protocol exchange objects
      Can pass configuration information: {"eid":"Exchange","label":"test exchange","pair":"BTC_USDT","meta":{"AccessKey":"123","SecretKey":"123","Front":"http://127.0.0.1:6666/test"}}.
      The label attribute is used to set a label for the current General Protocol connected exchange object, which can be retrieved in the strategy using the exchange.GetLabel() function.
  • name: Strategy name
  • node: Docker ID
    Specifies which docker to run on. If this attribute is not set, the system will automatically allocate.
  • period: Default K-line period
    K-line period parameter, 60 means 60 seconds.
  • strategy: Strategy ID
    Can be obtained using the GetStrategyList method.

Remarks

If the live trading bot was created through the extended API interface, it must be restarted using the extended API interface RestartRobot, and the settings parameter must be passed. For live trading bots created on the platform page, they can be restarted through the extended API interface or by clicking the button on the live trading page. The settings parameter can be passed or not. If only the robotId parameter is passed, it will start running according to the current settings of the live trading bot.

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_OKCoin" }, "phash": { "123": "ca1aca74b9cf7d8624f2af2dac01e36d" }, "plabels": { "123": "OKEX Futures V5" }, "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, i.e., the valid expiration time after current billing.
  • charged: Time consumed.
  • consumed: Amount consumed (0.125 USD = 12500000 / 1e8).
  • 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_OKCoin" is the exchange name.
  • 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

NameTypeRequiredDescription

robotId

number

Yes

The robotId parameter is used to specify the ID of the live trading bot for which to retrieve detailed information. The live trading bot information under the account, including the bot ID, can be obtained through the GetRobotList method.

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).

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, "currency":"USD", "email":"[email protected]", "openai":false, "settings":null, "sns":{"wechat":true}, "uid":"105ea6e51bcc177926a10fdbb7e2a1d6", "username":"abc" }, "error":null } }
  • balance: Account balance
    The value here is represented as an integer to ensure precision. The actual value needs to be divided by 1e8 (10 to the power of 8) for conversion. In this example, the actual balance is: 229.44702436

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

NameTypeRequiredDescription

isSummary

bool

Yes

The isSummary parameter is used to specify whether the returned data is summary information.

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

NameTypeRequiredDescription

nid

number

Yes

The nid parameter is used to specify the docker ID to be deleted. You can obtain the docker information under the account through the GetNodeList method.

The DeleteRobot method is used to delete a live trading bot under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The deleted bot ID is specified by the robotId parameter.

Returns

json
{ "code":0, "data":{ "result":0, "error":null } }
  • result: Feedback result of the bot deletion operation.
    • 0: Normal deletion.
    • -2: Deletion successful, but unable to contact the docker associated with the bot, please manually delete the file 123.db3!

Arguments

NameTypeRequiredDescription

robotId

number

Yes

The robotId parameter is used to specify the ID of the live trading bot to be deleted. You can use the GetRobotList method to get information about bots under the account, which includes the bot ID.

deleteLogs

bool

Yes

The deleteLogs parameter is used to set whether to delete the bot logs. If a truthy value is passed (e.g., true), the bot logs will be deleted.

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": 2, "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 strategies returned by the query.

Arguments

NameTypeRequiredDescription

offset

number

Yes

The offset parameter is used to set the query offset.

length

number

Yes

The length parameter is used to set the number of data entries returned by the query.

strategyType

number

Yes

The strategyType parameter is used to set the type of strategy to query.

  • Set strategyType parameter to 0: Query all strategies.

  • Set strategyType parameter to 1: Query published strategies.

  • Set strategyType parameter to 2: Query strategies pending review.

category

number

Yes

The category parameter is used to set the strategy category to query.

  • Set category parameter to -1: Query all strategies.

  • Set category parameter to 0: Query general strategies.

needArgs

number

Yes

The needArgs parameter is used to set whether the queried strategy requires parameters.

  • Set needArgs parameter to 0: Query all strategies.

language

number

Yes

The language parameter is used to set the programming language of the strategy to query.

  • Set language parameter to 0: JavaScript language.

  • Set language parameter to 1: Python language.

  • Set language parameter to 2: C++ language.

  • Set language parameter to 3: Visual strategy.

  • Set language parameter to 4: My language.

  • Set language parameter to 5: PINE language.

kw

string

Yes

The kw parameter is used to set keywords for querying strategies.

  • Set to an empty string to not use keyword filtering.

The NewRobot method is used to create a live trading bot under the FMZ Quant Trading Platform account corresponding to the API KEY in the request.

Returns

json
{ "code":0, "data":{ "result":591988, "error":null } }
  • result: Successfully created, returns the live trading ID.

Arguments

NameTypeRequiredDescription

settings

JSON Object

Yes

Live trading configuration parameters. The settings parameter format is as follows:

json
{ "appid":"test", "args":[], "exchanges":[ {"pair":"SOL_USDT","pid":123} ], "group":123, "name":"test", "node":123, "period":60, "strategy":123 }
  • group: Specify the live trading group.
  • args: Strategy parameters, empty array if the strategy has no parameters.
  • exchanges: Exchange object configuration, refer to the RestartRobot interface.

Remarks

Sensitive information such as "meta":{"AccessKey": "123", "SecretKey": "123"} configured in the eid of the settings parameter will not be stored by the FMZ Quant Trading Platform. This data will be directly forwarded to the docker program, so this information must be configured each time a live trading bot is created or restarted.

When creating a live trading bot using a general protocol exchange object, the exchanges property can use the following settings when configuring the settings parameter:

json
{ "eid": "Exchange", "label": "test", "pair": "ETH_BTC", "meta": { "AccessKey": "123", "SecretKey": "123", "Front": "http://127.0.0.1:6666/test" } }

The label property is used to set a label for the current general protocol connected exchange object, which can be retrieved in the strategy using the exchange.GetLabel() function.

The PluginRun method is used to call the debugging tool functionality of the FMZ Quant Trading Platform; only JavaScript language is supported.

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: Test result data returned after the debugging tool successfully executes the passed JavaScript code.

Arguments

NameTypeRequiredDescription

settings

JSON object

Yes

Setting parameters in the debugging tool, the settings configuration contains test code located in the source attribute. The settings parameter format is as follows:

json
{ "exchanges":[{"pair":"SOL_USDT","pid":123}], "node":123, "period":60, "source":"function main() {Log(\"Hello FMZ\")}" }
  • source: The code to be debugged.
  • node: Docker ID, specifies which docker to run the live trading on. If this value is -1, it means automatic allocation.
  • exchanges: Exchange object configuration, refer to the RestartRobot interface.

Remarks

{"eid": "OKEX", "pair": "ETH_BTC", "meta" :{"AccessKey": "123", "SecretKey": "123"}}
{"eid": "Huobi", "pair": "BCH_BTC", "meta" :{"AccessKey": "123", "SecretKey": "123"}}

For the exchanges attribute in settings, only one needs to be set when calling the PluginRun method (only one exchange object is supported when using the debugging tool page). Setting 2 exchange objects in settings will not cause an error, but accessing the second exchange object in the code will cause an error.

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

NameTypeRequiredDescription

robotId

number

Yes

The robotId parameter is used to specify the live trading ID for which to get log information. You can use the GetRobotList method to get the live trading information under the account, which includes the live trading ID.

logMinId

number

Yes

The logMinId parameter is used to specify the minimum ID of log records.

logMaxId

number

Yes

The logMaxId parameter is used to specify the maximum ID of log records.

logOffset

number

Yes

The logOffset parameter is used to set the offset. Within the range determined by logMinId and logMaxId, skip the specified number of records according to logOffset to determine the starting position for data retrieval.

logLimit

number

Yes

The logLimit parameter is used to set the number of data records to retrieve starting from the initial position.

profitMinId

number

Yes

The profitMinId parameter is used to set the minimum ID of profit logs.

profitMaxId

number

Yes

The profitMaxId parameter is used to set the maximum ID of profit logs.

profitOffset

number

Yes

The profitOffset parameter is used to set the offset, i.e., skip the specified number of records as the starting position.

profitLimit

number

Yes

The profitLimit parameter is used to set the number of data records to retrieve starting from the initial position.

chartMinId

number

Yes

The chartMinId parameter is used to set the minimum ID of chart data records.

chartMaxId

number

Yes

The chartMaxId parameter is used to set the maximum ID of chart data records.

chartOffset

number

Yes

The chartOffset parameter is used to set the offset.

chartLimit

number

Yes

The chartLimit parameter is used to set the number of records to retrieve.

chartUpdateBaseId

number

Yes

The chartUpdateBaseId parameter is used to set the base ID for querying update records.

chartUpdateDate

number

Yes

The chartUpdateDate parameter is used to set the update timestamp of data records, and the system will filter out records greater than this timestamp.

summaryLimit

number

Yes

The summaryLimit parameter is used to set the number of bytes of status bar data to query. This parameter is an integer used to query the status bar data of live trading.

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 summary field of the returned data.

Remarks

  • Strategy log table in database
    The description of the Arr attribute value in the first element (log data) of the logs attribute value (array structure) in the returned data is as follows:

    plaintext
    "Arr": [ [3977, 3, "Futures_OKCoin", "", 0, 0, "Sell(688.9, 2): 20016", 1526954372591, "", ""], [3976, 5, "", "", 0, 0, "OKCoin:this_week Position too large, long: 2", 1526954372410, "", ""] ],
    idlogTypeeidorderIdpriceamountextradatecontractTypedirection
    39773"Futures_OKCoin"""00"Sell(688.9, 2): 20016"1526954372591""""
    39765""""00"OKCoin:this_week Position too large, long: 2"1526954372410""""

    extra is the additional information for the printed log.

    The log type descriptions corresponding to logType values are as follows:

    logType:0123456
    logType meaning:BUYSALERETRACTERRORPROFITMESSAGERESTART
    English meaningBuy order logSell order logCancel orderErrorProfitMessageRestart
  • 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]

    202 is the log ID, 2515.44 is the profit value, 1575896700315 is 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}"],

    23637 is the log ID, 0 is 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.