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
severityEventSeveritySeverity level of the raised event.
idstringIdentifier 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.
categoryEventCategoryCategory of the raised event. This must not be set to TradeSystem.
chartInformationChartInformationOptionally, information about visualization of the event on the chart.
messagestringEvent message in markdown which may contain composite formatting items. Final markdown message string must not be longer than MaxEventMessageLength.
argsobject[]If
messagecontains composite formatting items, these are the format arguments.
Returns
- bool
If the trade script runs in the production mode, the return value is
truein case the event was successfully created and inserted to the queue from which it will be sent to the Core application. The return value isfalsein 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
trueor it throws an exception in case of a failure.
Exceptions
- InvalidArgumentException
Thrown if the trade script runs in the debug mode and
idor the message after being formatted exceed the maximum allowed length, or ifidormessageisnull, or ifcategoryis 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
severityEventSeveritySeverity level of the raised event.
idstringIdentifier 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.
categoryEventCategoryCategory of the raised event. This must not be set to TradeSystem.
messagestringEvent message in markdown which may contain composite formatting items. Final markdown message string must not be longer than MaxEventMessageLength.
argsobject[]If
messagecontains composite formatting items, these are the format arguments.
Returns
- bool
If the trade script runs in the production mode, the return value is
truein case the event was successfully created and inserted to the queue from which it will be sent to the Core application. The return value isfalsein 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
trueor it throws an exception in case of a failure.
Exceptions
- InvalidArgumentException
Thrown if the trade script runs in the debug mode and
idor the message after being formatted exceed the maximum allowed length, or ifidormessageisnull, or ifcategoryis set to TradeSystem.- InvalidStateException
Thrown if the trade script runs in the debug mode and the event cannot be delivered.