GetRobotLogs
Gets the strategy log, profit log, chart data and status bar data of one robot of the account.
Examples
Query the latest 10 strategy log entries and the status bar of robot 123, passing arguments by name.
python
# api() is the function in the Python example on the signature authentication page
r = api('GetRobotLogs', robotId=123, logLimit=10, summaryLimit=1)
result = r['data']['result']
for row in result['logs'][0]['Arr']:
print(row)
print(result['summary']) # status bar dataReturns
| Type | Description |
object | On success |
Arguments
| Name | Type | Required | Description |
robotId | number | Yes | Robot ID; see |
logMinId | number | Yes | Minimum ID of strategy log entries. |
logMaxId | number | Yes | Maximum ID of strategy log entries. |
logOffset | number | Yes | Number of records to skip within the range given by |
logLimit | number | Yes | Number of records to return from the starting position. |
profitMinId | number | Yes | Minimum ID of profit log entries. |
profitMaxId | number | Yes | Maximum ID of profit log entries. |
profitOffset | number | Yes | Number of records to skip. |
profitLimit | number | Yes | Number of records to return. |
chartMinId | number | Yes | Minimum ID of chart log entries. |
chartMaxId | number | Yes | Maximum ID of chart log entries. |
chartOffset | number | Yes | Number of records to skip. |
chartLimit | number | Yes | Number of records to return. |
chartUpdateBaseId | number | Yes | Base ID for querying updates. |
chartUpdateDate | number | Yes | Update timestamp; only newer records are returned. |
summaryLimit | number | Yes | Whether to return status bar data: |
logExchange | string | No | Return only logs of this exchange object (by label); an empty string means no filter. |
logKeyword | string | No | Return only logs whose content contains this keyword; an empty string means no filter. |
logTypes | string | No | Return only these log types, comma-separated type numbers, e.g. |
Attributes
| Name | Type | Description |
logs | array | Three objects: the query results of the strategy log, profit log and chart log tables of the robot database, in that order; the |
summary | string | Status bar data of the robot (returned when |
status | number | Robot status code, see |
Remarks
With this many parameters, passing them by name is recommended (missing ones take their defaults); positional calls take 15 to 19 arguments (with 15 the status bar is not queried). The three filters logExchange, logKeyword and logTypes work only on new dockers; old dockers ignore them and return all logs.
logs[0]: strategy log
Each entry of logs[0].Arr is an array of: log ID (id), log type (logType), label of the exchange object (platformId), order ID (orderId), price (price), amount (amount), extra message of the log (extra), timestamp (date), contract code (contractType), direction (direction). For example:
plaintext
"Arr": [
[3977, 3, "Futures_OKX", "", 0, 0, "Sell(688.9, 2): 20016", 1526954372591, "", ""],
[3976, 5, "", "", 0, 0, "this_week too many positions, long: 2", 1526954372410, "", ""]
]
Values of logType:
| logType | Name | Meaning |
|---|---|---|
| 0 | BUY | Buy order |
| 1 | SALE | Sell order |
| 2 | RETRACT | Order cancelled |
| 3 | ERROR | Error |
| 4 | PROFIT | Profit |
| 5 | MESSAGE | Log message |
| 6 | RESTART | Restart |
logs[1]: profit log
The same as the profit entries of the strategy log; each entry is log ID, profit value, timestamp. In [202, 2515.44, 1575896700315], 202 is the log ID, 2515.44 the profit and 1575896700315 the timestamp:
plaintext
"Arr": [
[202, 2515.44, 1575896700315],
[201, 1415.44, 1575896341568]
]
logs[2]: chart log
Each entry is log ID, chart series index, data (JSON text). In [23637, 0, "{\"close\":648, ...}"], 23637 is the log ID, 0 the series index, and the JSON text is one K-line on the chart:
plaintext
"Arr": [
[23637, 0, "{\"close\":648,\"high\":650.5,\"low\":647,\"open\":650,\"x\":1575960300000}"],
[23636, 5, "{\"x\":1575960300000,\"y\":3.0735}"]
]
Example response
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
}
}