Custom Tool #
The custom
tool sends an HTTP POST
request to the provided URL.
The request’s body has a JSON array that is either empty or contains
the same elements as the configuration’s payload
property.
The response is expected to have the 200
status code and a body that
contains the following JSON object:
{
"permit": true
}
permit
- boolean
The property that is used as the tool’s execution result.
In case of an error, the server should respond with an appropriate HTTP
status code (4XX
or 5XX
) and a body containing the following JSON object:
{
"message": "internal error"
}
message
- string
The message of the error.
The CUSTOM-TIMESTAMP
header is used to send a timestamp of each request’s
creation. The custom tool may use it to reject a request if it arrives
later than expected.
A timestamp is a number of seconds since the Unix Epoch in UTC.
The custom
tool cannot be backtested. More information about strategy
backtesting can be found here.
Configuration #
{
"type": "custom",
"context_id": "custom-id-123",
"description": "a simple tool",
"url": "http://custom-server/path/to/tool/endpoint",
"key": "cQoRSm21nyovtTcufM8Si2IBHtN",
"secret": "qXN4yR2KXQzs7c0DcXWVEOSNIhTrvG",
"payload": [
"{{tools.sma-checker.value}}",
"{{tools.ema-checker.value}}",
"rsi: {{tools.rsi-checker.value}}; macd: {{tools.macd-checker.value}}",
"300.42",
"true",
"success"
]
}
-
type
- string
The type of the tool configuration.Tool configuration types are described in detail here.
-
context_id
- string (optional; default: unused)
The ID of the tool that is used when inserting data into the context store.The context data store and its IDs are described in detail here.
-
description
- string (optional; default: unused)
The description of the tool and its purpose. -
url
- string
The URL to which a request is sent. It must be a valid URL as described here. -
key
- string (optional; default: unused)
The authentication key that is sent in theCUSTOM-KEY
header. It may be used to authenticate requests in the custom tool’s system. -
secret
- string (optional; default: unused)
The secret key that is used to sign requests before sending them to the custom tool. The generated signature is sent in theCUSTOM-SIGNATURE
header.The signature generation process is described in detail here.
-
payload
- array of strings (context; optional; default: unused)
The array of strings that is sent to the target URL. Each string may contain multiple context value placeholders.If this property is omitted, an empty array is sent.
Report #
{
"type": "custom",
"permit": true
}
-
type
- string
The type of the tool report.Tool report types are described in detail here.
-
permit
- boolean
The property that determines whether the tool gave its permission to continue strategy execution or not.The tool execution flow is described in detail here.
If an error occurs during thecustom
tool’s execution, onlytype
anderror
properties are added to the report. Theerror
property is described in detail here.
Context #
The objects that the custom
tool inserts into the context
store are as follows:
tools.<context-id>.permit
- boolean
The object that determines whether the tool gave its permission to continue strategy execution or not.
If an error occurs during thecustom
tool’s execution, only thetools.<context-id>.error
object is inserted into the context store. This context data object is described in detail here.