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

Explanation of Extended API Interface

  • The extended API Interface of FMZ Quant Trading Platform Append the query parameters (separated by ? ) of the request directly after https://www.fmz.com/api/v1. The following are the request parameters expressed using Python:

    {
        "version"   : "1.0",
        "access_key": "xxx",
        "method"    : "GetNodeList",
        "args"      : [],
        "nonce"     : 1516292399361,
        "sign"      : "085b63456c93hfb243a757366600f9c2"
    }
    
    Fields Directions
    version Version number.
    access_key AccessKey, apply for it on the account management page.
    method The specific calling method.
    args The parameter list of the specific method called.
    nonce Timestamp, in milliseconds, allows a 1-hour error from the standard time stamp. Nonce must be larger than the nonce value of the last access.
    sign Signature.

    Each parameter name is separated by the character &, and the parameter names and values are connected with the symbol =. The complete request URL (taking method=GetNodeList as an example):

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

    Note that there is no secret_key parameter among request parameters.

  • Signature Method The sign parameter in the request parameter is encrypted as follows, according to the format:

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

    After concatenating strings, use MD5 encryption algorithm to encrypt the string and convert it to a hexadecimal data string value, referred as the value of parameter sign. For the signature part, refer to the Python code extension API interface Ways of Verification :

    # Parameter
    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 service error:

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

GetNodeList

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

{
    "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
    }
}

Description of the return value fields (the literal meaning is obvious and will not be repeated):

  • all: The number of dockers associated with the current account.
  • nodes: Records the docker node details.
    • build: Version number.
    • city: The city where you locating.
    • is_owner: true indicates a private docker, false indicates a public docker.
    • loaded: Load, the number of strategy instances.
    • public: 0 indicates a private docker, 1 indicates a public docker.
    • region: Geographical location.
    • version: Detailed version information of the docker.
    • wd: Whether to enable offline alarm, 0 means not enabled. The one-click deployment docker contains some additional information. The fields start with the prefixes ecs_ and unit_, which records the relevant information of the one-click deployment docker server (operator name, configuration, status, etc.), billing cycle, price and other information, which will not be repeated here.

No parameter

GetRobotGroupList

GetRobotGroupList() returns the live trading grouping list of FMZ Quant Trading Platform account corresponding to the API KEY in the request.

{
    "code": 0,
    "data": {
        "result": {
            "items": [{
                "id": 3417,
                "name": "Test"
            }, {
                "id": 3608,
                "name": "Live trading demo"
            }]
        },
        "error": null
    }
}
  • items: Live trading grouping information.
    • id: Live trading grouping Id.
    • name: Live trading grouping name. The items field only records newly created groups. The “default” group is not in items.

No parameter

GetPlatformList

GetPlatformList() returns the list of exchanges that have been added by the FMZ Quant Trading Platform account corresponding to the API KEY in the request.

{
    "code": 0,
    "data": {
        "result": {
            "all": 2,
            "platforms": [{
                "category": "加密货币||Crypto",
                "date": "2023-12-07 13:44:52",
                "eid": "Binance",
                "id": 123,
                "label": "Binance",
                "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 Exchange REST Protocol",
                "logo": "...",
                "name": "通用协议|Custom Protocol",
                "stocks": ["BTC_USDT", "ETH_USDT"],
                "website": ""
            }]
        },
        "error": null
    }
}
  • all: The number of exchange objects added/configured.
  • platforms: Information related to the exchange.
    • eid: The ID of the exchange on the FMZ Quant Trading Platform, eid will be used in some configurations and parameters.

No parameter

GetRobotList

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

{
    "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 information
    • group_id: The live trading group ID. If the strategy live trading is in the default group, there is no group_id field.

The paging query offset setting. offset false number The paging query length setting. length false number Specify the status of the live trading to be queried, refer to the extended API interface Live Trading Code, pass -1 to get all live tradings. robotStatus false number Specify the custom label of the live trading you want to query, and you can filter all the live tradings of this label. label false string Search keywords. keyWord false string

Take the Python language’s extended API interface Ways of Verification as an example: print(api('GetRobotList')): Get all live trading information. print(api('GetRobotList', 'member2')): print the information of all live trading with the custom label member2. print(api('GetRobotList', 0, 5, -1, 'member2')): pages from 0 to 5 and list up to 5 robots labeled with member2.

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.

StopRobot

StopRobot(RobotId) is used to request the API KEY corresponding to the live trading of the FMZ Quant Trading Platform account. The live trading Id to stop running is the live trading Id specified by the robotId parameter.

{
    "code":0,
    "data":{
        "result":2,
        "error":null
    }
}
  • result: The live trading status code is 2, which means stopped.

The parameter robotId is used to specify the Id of the live trading to be stopped. 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

RestartRobot

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

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

The robotId parameter is used to specify the Id of the live trading to be restarted. 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 live trading configuration parameters, the parameters settings format is as follows:

{
    "appid":"test",
    "args":[],
    "exchanges":[
        {"pair":"SOL_USDT","pid":123},
        {"pair":"ETH_USDT","pid":456}
    ],
    "name":"test",
    "node":123,
    "period":60,
    "strategy":123
}
  • appid: Custom fields Tags can be defined.
  • args: Strategy parameter settings The structure is an array, each element is a parameter. For example, if the strategy has a parameter Interval, and you want to set Interval to 500 when restarting the strategy, then args contains: ["Interval", 500], that is: "args": [["Interval", 500]].
  • exchanges: Exchange object configuration for live trading binding The structure is an array, where each element is an exchange object configuration.
    • It can bind to the exchange object that has been configured on the platform That is, use pid configuration: {"pair":"SOL_USDT","pid":123}; pid can be queried through the GetPlatformList interface, and the id field in the returned data is the exchange pid.
    • We can directly pass in configuration information and bind exchange objects That is, use eid configuration: {"eid":"Huobi","label":"test Huobi","meta":{"AccessKey":"123","SecretKey":"123"},"pair":"BCH_BTC"}; sensitive information such as API KEY is not stored by the FMZ Quant Trading Platform, and these data are directly forwarded to the docker program. If this type of configuration is used, the information must be configured each time a live trading is created or restarted.
    • It can bind Custom Protocol exchange object It can pass in configuration information: {"eid":"Exchange","label":"test exchange","pair":"BTC_USDT","meta":{"AccessKey":"123","SecretKey":"123","Front":"http://127.0.0.1:6666/test"}}. label attribute is to set a label for the exchange object accessed by the current Custom Protocol, which can be obtained by the exchange.GetLabel() function in the strategy.
  • name: Strategy name
  • node: Docker ID Specifies which docker to run on. If this attribute is not set, the docker will be assigned to run automatically.
  • period: Default K-line period K-line period parameter, 60 means 60 seconds.
  • strategy: Strategy ID It can be obtained using the GetStrategyList method.

settings false JSON Object

If a live trading is created by the extended API, the extended API RestartRobot (RobotId, Settings) must be used to restart, and the settings parameter must be passed. The live trading created on the platform page can be restarted through the extended API or by clicking the button on the page. You can pass or don’t pass the settings parameter. If you only pass the RobotId parameter, start live trading according to the current live trading settings.

GetRobotDetail

The GetRobotDetail method is used to get the details of the live trading under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The Id of the live trading to be retrieved is the live trading Id specified by the robotId parameter.

{
    "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: The next deduction time is the effective expiration time after the current deduction.
  • charged: Time already consumed.
  • consumed: Amount consumed (0.125 USD = 12500000 / 1e8).
  • date: Creation date.
  • fixed_id: The docker ID assigned when the live trading is running. If it is automatic, the value is -1.
  • is_manager: Whether you have the authority to manage this live trading.
  • is_sandbox: Whether it is a simulated trading.
  • name: Name of the live trading.
  • node_id: Docker ID。
  • pexchanges: The exchange object of the live trading, 123 is the pid, and “Futures_OKCoin” is the exchange name.
  • plabels: Tag information of the exchange object configured in the live trading.
  • profit: Live trading profit data.
  • public: Whether the live trading is public.
  • refresh: Last active time.
  • strategy_exchange_pairs: Configured exchange object, set trading pair information.
  • wd: Whether to enable offline alarm.

The robotId parameter is used to specify the Id of the live trading for which the details are to be obtained. You can use the GetRobotList method to obtain information about the live trading under the account, which contains the live trading Id.

robotId true number

The attribute description of strategy_exchange_pairs, take the following data as an example:

"[60,[44314,42960,15445,14703],[\"BTC_USDT\",\"BTC_USDT\",\"ETH_USDT\",\"ETH_USDT\"]]"

The first data 60 represents the default K-line period set by live trading is 1 minute, namely 60 seconds.

[44314,42960,15445,14703] is the exchange object pid configured for live trading (according to the addition order).

[\"BTC_USDT\",\"BTC_USDT\",\"ETH_USDT\",\"ETH_USDT\"] is the trading pair set for the exchange object configured by live trading (in the order of addition and in one-to-one correspondence with pid).

GetAccount

The GetAccount method is used to acquire the account information corresponding to the API KEY in the request of the FMZ Quant Trading Platform account.

{
    "code":0,
    "data":{
        "result":{
            "balance":22944702436,
            "concurrent":0,
            "consumed":211092719653,
            "currency":"USD",
            "email":"123@qq.com",
            "openai":false,
            "settings":null,
            "sns":{"wechat":true},
            "uid":"105ea6e51bcc177926a10fdbb7e2a1d6",
            "username":"abc"
        },
        "error":null
    }
}
  • balance: Account balance The value here is an integer due to precision control. To convert it into an actual value, you need to divide it by 1e8 (i.e. 10 to the 8th power). The actual value here is: 229.44702436

GetExchangeList

The GetExchangeList method is used to acquire the list of exchanges and the required configuration information supported by FMZ Quant Trading Platform.

When the isSummary parameter is false, the returned data is:

{
    "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 is:

{
    "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.

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

isSummary true bool

DeleteNode

The DeleteNode(Nid) method is used to delete the docker node corresponding to the API KEY in the request of the FMZ Quant Trading Platform account. The deleted docker node Id is the docker Id specified by the nid parameter.

{
    "code":0,
    "data":{
        "result":true,
        "error":null
    }
}
  • result: Whether the associated docker program is deleted successfully.

The nid parameter is used to specify the Id of the docker to be deleted. You can use the GetNodeList method to get information about the dockers of the account.

nid true number

DeleteRobot

The DeleteRobot(RobotId, DeleteLogs) method is used to delete the live trading corresponding to the API KEY in the request under the FMZ Quant Trading Platform account. The deleted live trading Id is the live trading Id specified by the robotId parameter.

{
    "code":0,
    "data":{
        "result":0,
        "error":null
    }
}
  • result: The result of the live trading deletion operation feedback. 0: Delete normally. -2: The deletion was successful, but the docker associated with the live trading could not be contacted. Please delete the file 123.db3 manually!

The parameter robotId is used to specify the Id of the live trading to be deleted. 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 deleteLogs parameter is used to set whether to delete the live trading log, if passed a true value (e.g.: true), the live trading log is deleted.

deleteLogs true bool

GetStrategyList

The GetStrategyList method is used to obtain platform strategy information.

{
    "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: The total number of strategies found by the filter query.
  • strategies: Specific strategy information queried.

The offset parameter is used to set the offset when querying.

offset true number The length parameter is used to set the length of the query.

length true number The strategyType parameter is used to set the strategy type to be queried.

  • strategyType parameter setting 0: all strategies.
  • strategyType parameter setting 1: The strategy is public.
  • strategyType parameter setting 2: strategy to be reviewed.

strategyType true number The category parameter is used to set the strategy category to be queried.

  • category parameter setting -1: all strategies.
  • category parameter setting 0: custom strategy.

category true number The needArgs parameter is used to set whether the strategy to be queried has parameters.

  • needArgs parameter setting 0: all strategies.

needArgs true number The language parameter is used to set the programming language of the strategy to be queried.

  • language parameter settings 0: JavaScript language.
  • language parameter settings 1: Python language.
  • language parameter settings 2: C++ language.
  • language parameter settings 3: Visualization strategy.
  • language parameter settings 4: My language.
  • language parameter settings 5: PINE language.

language true number The kw parameter is used to set the keyword of the strategy to be queried.

  • Setting an empty string means no keyword filtering is used.

kw true string

NewRobot

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

{
    "code":0,
    "data":{
        "result":591988,
        "error":null
    }
}
  • result: The creation is successful and the live trading ID is returned.

The live trading configuration parameters, settings parameters format is as follows:

{
    "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, or an empty array if the strategy has no parameters.
  • exchanges: For exchange object configuration, please refer to the RestartRobot interface.

settings true JSON object

In the configuration of eid in the settings parameter, "meta":{"AccessKey": "123", "SecretKey": "123"} these sensitive information is not stored by the FMZ Quant Trading Platform. These data are forwarded to the docker program directly, so this information must be configured every time a live trading is created or restarted.

If we create a live trading exchange object using the custom protocol, when configuring the settings parameter, we can use the following settings for the exchanges attribute:

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

label attribute is to set a label for the exchange object accessed by the current custom protocol, which can be obtained by the exchange.GetLabel() function in the strategy.

PluginRun

The PluginRun method is used to call the debug tool function of the FMZ Quant Trading Platform; Only JavaScript language is supported.

{
    "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 debugging tool returns the test result data after executing the passed JavaScript code successfully.

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

{
    "exchanges":[{"pair":"SOL_USDT","pid":123}],
    "node":123,
    "period":60,
    "source":"function main() {Log(\"Hello FMZ\")}"
}
  • source: Code that needs debugging.
  • node: Docker ID, you can specify which docker to run the live trading on. If the value is -1, it means automatic allocation.
  • exchanges: For exchange object configuration, please refer to the RestartRobot interface.

settings true JSON object

{"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 used in the debug tool page). No error will be reported when you set 2 exchange objects in settings, but an error will be reported when the second exchange object is accessed in the code.

GetRobotLogs

The GetRobotLogs method is used to get the log information of the live trading under the FMZ Quant Trading Platform account corresponding to the API KEY in the request. The Id of the live trading platform to be obtained is the live trading platform Id specified by the robotId parameter.

{
    "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: Several log data items are found in the Arr field. The first data structure in logs is the log record in the strategy log table in the live trading database. The second data structure in logs is the log record in the strategy log table in the live trading database. The third data structure in logs is the log record in the strategy log table in the live trading database.
  • summary: Live trading status bar data.

The robotId parameter is used to specify the Id of the live trading for which the log information is to be obtained. You can use the GetRobotList method to obtain information about the live trading under the account, which contains the live trading Id.

robotId true number The logMinId parameter is used to specify the minimum Id of the Log.

logMinId true number The logMaxId parameter is used to specify the maximum Id of the Log.

logMaxId true number The logOffset parameter is used to set the offset, after determining the range by logMinId and logMaxId, offset based on the logOffset (how many records are skipped). Start as the starting position for fetching data.

logOffset true number The parameter logLimit is used to set the number of data records to be selected after the starting position is determined.

logLimit true number The profitMinId parameter is used to set the minimum Id of the profit log.

profitMinId true number The parameter profitMaxId is used to set the maximum Id of the profit log.

profitMaxId true number The parameter profitOffset is used to set the offset (how many records are skipped) as the starting position.

profitOffset true number The parameter profitLimit is used to set the number of data records to be selected after the starting position is determined.

profitLimit true number The parameter chartMinId is used to set the minimum Id of the chart data record.

chartMinId true number The parameter chartMaxId is used to set the maximum Id of the chart data record.

chartMaxId true number The parameter chartOffset is used to set the offset.

chartOffset true number The parameter chartLimit is used to set the number of records to obtain.

chartLimit true number The parameter chartUpdateBaseId is used to set the base Id after the query is updated.

chartUpdateBaseId true number The parameter chartUpdateDate is used to set the data record update timestamp, and it will filter out records greater than this timestamp.

chartUpdateDate true number The parameter summaryLimit is used to set the number of bytes of status bar data to be queried. The parameter is of integer type for querying the status bar data of the live trading. Setting to “0” means there is no need to query the status bar information, and setting to non-zero number indicates the number of bytes of the status bar information to be queried (the interface does not limit the data quantity, so you can specify a larger summaryLimit parameter to get all status bar information). The status bar data is stored in the returned data summary.

summaryLimit true number

  • The strategy log table in the database The Arr attribute value in the first element of the Logs attribute value (array structure) in the return data (log data) is described as follows:

    "Arr": [
        [3977, 3, "Futures_OKCoin", "", 0, 0, "Sell(688.9, 2): 20016", 1526954372591, "", ""],
        [3976, 5, "", "", 0, 0, "OKCoin:this_week too many positions, long: 2", 1526954372410, "", ""]
    ],
    
    id logType eid orderId price amount extra date contractType direction
    3977 3 “Futures_OKCoin” "" 0 0 “Sell(688.9, 2): 20016” 1526954372591 "" ""
    3976 5 "" "" 0 0 “OKCoin:this_week too many positions, long: 2” 1526954372410 "" ""

    extra is the attached message of the printed log.

    The specific log types represented by the logType values are described as follows:

    logType: 0 1 2 3 4 5 6
    Meaning of logType: BUY SALE RETRACT ERROR PROFIT MESSAGE RESTART
  • Log table of the profit chart in the database The data in the chart’s log table is consistent with the profit log in the strategy log table.

    "Arr": [
        [202, 2515.44, 1575896700315],
        [201, 1415.44, 1575896341568]
    ]
    

    Take one of the log data as an example:

    [202, 2515.44, 1575896700315]
    

    202 is log ID; 2515.44 is profit value; 1575896700315 is timestamp.

  • Chart log table in the database

    "Arr": [
        [23637, 0, "{\"close\":648,\"high\":650.5,\"low\":647,\"open\":650,\"x\":1575960300000}"],
        [23636, 5, "{\"x\":1575960300000,\"y\":3.0735}"]
    ]
    

    Take one of the log data as an example:

    [23637, 0, "{\"close\":648,\"high\":650.5,\"low\":647,\"open\":650,\"x\":1575960300000}"],
    

    23637 is the log ID, 0 is the index of the chart data series, and the last data "{\"close\":648,\"high\":650.5,\"low\":647,\"open\":650,\"x\":1575960300000}" is the log data; This data is the K-line data on the chart.

Ways of Verification Trading Terminal