Custom

Custom Outcome #

The custom outcome 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 204 status code and no body.

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 outcome 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 outcome cannot be backtested. More information about strategy backtesting can be found here.

Configuration #

{
	"type": "custom",
	"context_id": "custom-id-123",
	"description": "a simple outcome",
	"url": "http://custom-server/path/to/outcome/endpoint",
	"key": "cQoRSm21nyovtTcufM8Si2IBHtN",
	"secret": "qXN4yR2KXQzs7c0DcXWVEOSNIhTrvG",
	"payload": [
		"{{tools.sma-checker.value}}",
		"{{outcomes.order-placer.id}}",
		"quantity: {{outcomes.order-placer.quantity}}; price: {{outcomes.order-placer.price}}",
		"300.42",
		"true",
		"success"
	]
}
  • type - string
    The type of the outcome configuration.

    Outcome configuration types are described in detail here.

  • context_id - string (optional; default: unused)
    The ID of the outcome 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 outcome 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 the CUSTOM-KEY header. It may be used to authenticate requests in the custom outcome’s system.

  • secret - string (optional; default: unused)
    The secret key that is used to sign requests before sending them to the custom outcome. The generated signature is sent in the CUSTOM-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"
}
  • type - string
    The type of the outcome report.
    Outcome report types are described in detail here.
If an error occurs during the custom outcome’s execution, only type and error properties are added to the report. The error property is described in detail here.

Context #

The custom outcome does not insert any objects into the context store.

If an error occurs during the custom outcome’s execution, only the outcomes.<context-id>.error object is inserted into the context store. This context data object is described in detail here.