Caplin Trader 5.1.0

Interface: module:ct-alerts/TriggerService

module:ct-alerts/TriggerService

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

This service can be accessed from the module:ct-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:ct-alerts/TriggerServiceEvents.

Methods

create(properties, erroropt, successopt)

A request to create a module:ct-alerts/Trigger.

If the request is successful, an ADDED event will be raised (see module:ct-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>

A callback that will be invoked if the request fails.

success function <optional>

A callback that will be invoked when the request succeeds.

disableTrigger(trigger, erroropt, successopt)

Disables a trigger in the system.

Parameters:
Name Type Attributes Description
trigger ct-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:ct-alerts/TriggerServiceEvents).

Parameters:
Name Type Attributes Description
trigger module:ct-alerts/Trigger

The trigger to dispose.

error function <optional>

A callback that will be invoked if the request fails.

success function <optional>

A callback that will be invoked when the request succeeds.

enableTrigger(trigger, erroropt, successopt)

Enables a trigger in the system.

Parameters:
Name Type Attributes Description
trigger ct-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