Caplin Trader 4.8.0

Interface: module:caplin/alerts/TriggerService

module:caplin/alerts/TriggerService

The TriggerService provides access to the user's module:caplin/alerts/Triggers.

This service can be accessed from the module:caplin/core/ServiceRegistry, using the alias caplin.alerts.trigger-service. There is no default implementation for this service.

This interface uses emitr allowing services implementing this interface to trigger events.

The service will emit events defined in module:caplin/alerts/TriggerServiceEvents.

Methods

create(properties, erroropt, successopt)

A request to create a module:caplin/alerts/Trigger.

If the request is successful, an ADDED event will be raised (see module:caplin/alerts/TriggerServiceEvents).

Parameters:
Name Type Attributes Description
properties map The properties of the trigger to be created. Should contain the following:
subject
(String) The subject of the instrument to be monitored by the trigger.
condition
(String) The condition that when met will trigger the trigger.
error function <optional>
Callback invoked if the request fails.
success function <optional>
Callback invoked if the request succeeds.

disableTrigger(trigger, erroropt, successopt)

Disables a trigger in the system.

Parameters:
Name Type Attributes Description
trigger caplin/alerts/Trigger The trigger to be disabled.
error function <optional>
callback invoked on streamlink contrib error.
success function <optional>
callback invoked on successful trigger disabling.
Throws:
If trigger parameter is not a Trigger, not found in the current list, or if error and success are not functions.
Type
br/Errors.INVALID_PARAMETERS

dispose(trigger, erroropt, successopt)

A request to dispose the given trigger, removing it from the user's list of triggers.

If the request is successful, a REMOVED event will be raised (see module:caplin/alerts/TriggerServiceEvents).

Parameters:
Name Type Attributes Description
trigger module:caplin/alerts/Trigger The trigger to dispose.
error function <optional>
Callback invoked if the request fails.
success function <optional>
Callback invoked if the request succeeds.

enableTrigger(trigger, erroropt, successopt)

Enables a trigger in the system.

Parameters:
Name Type Attributes Description
trigger caplin/alerts/Trigger The trigger to be enabled.
error function <optional>
callback invoked on streamlink contrib error.
success function <optional>
callback invoked on successful trigger enabling.
Throws:
If trigger parameter is not a Trigger, not found in the current list, or if error and success are not functions.
Type
br/Errors.INVALID_PARAMETERS