Table of Contents

Method TriggerEvent

Namespace
WhalesSecret.TradeScriptLib.API
Assembly
WhalesSecret.TradeScriptLib.dll

TriggerEvent(EventSeverity, string, EventCategory, ChartInformation?, string, params object?[])

Raises an event in the trade script, which is sent to the Core application and can be consumed by the user.

bool TriggerEvent(EventSeverity severity, string id, EventCategory category, ChartInformation? chartInformation, string message, params object?[] args)

Parameters

severity EventSeverity

Severity level of the raised event.

id string

Identifier of the event assigned to it by the originating trade script. This should be a short string that may help to identify the event, such as an event code. It must not be longer than MaxEventIdLength.

category EventCategory

Category of the raised event. This must not be set to TradeSystem.

chartInformation ChartInformation

Optionally, information about visualization of the event on the chart.

message string

Event message in markdown which may contain composite formatting items. Final markdown message string must not be longer than MaxEventMessageLength.

args object[]

If message contains composite formatting items, these are the format arguments.

Returns

bool

If the trade script runs in the production mode, the return value is true in case the event was successfully created and inserted to the queue from which it will be sent to the Core application. The return value is false in case of a formatting error or a violation of arguments constraints, or in case the event cannot be delivered.

If the trade script runs in the debug mode, the method only returns true or it throws an exception in case of a failure.

Exceptions

InvalidArgumentException

Thrown if the trade script runs in the debug mode and id or the message after being formatted exceed the maximum allowed length, or if id or message is null, or if category is set to TradeSystem.

InvalidStateException

Thrown if the trade script runs in the debug mode and the event cannot be delivered.

TriggerEvent(EventSeverity, string, EventCategory, string, params object?[])

Raises an event in the trade script, which is sent to the Core application and can be consumed by the user.

bool TriggerEvent(EventSeverity severity, string id, EventCategory category, string message, params object?[] args)

Parameters

severity EventSeverity

Severity level of the raised event.

id string

Identifier of the event assigned to it by the originating trade script. This should be a short string that may help to identify the event, such as an event code. It must not be longer than MaxEventIdLength.

category EventCategory

Category of the raised event. This must not be set to TradeSystem.

message string

Event message in markdown which may contain composite formatting items. Final markdown message string must not be longer than MaxEventMessageLength.

args object[]

If message contains composite formatting items, these are the format arguments.

Returns

bool

If the trade script runs in the production mode, the return value is true in case the event was successfully created and inserted to the queue from which it will be sent to the Core application. The return value is false in case of a formatting error or a violation of arguments constraints, or in case the event cannot be delivered.

If the trade script runs in the debug mode, the method only returns true or it throws an exception in case of a failure.

Exceptions

InvalidArgumentException

Thrown if the trade script runs in the debug mode and id or the message after being formatted exceed the maximum allowed length, or if id or message is null, or if category is set to TradeSystem.

InvalidStateException

Thrown if the trade script runs in the debug mode and the event cannot be delivered.