Caplin Trader 4.0.3

Interface: module:caplin/alerts/TriggerService

module:caplin/alerts/TriggerService

Summary

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>
A callback that will be invoked if the request fails.
success function <optional>
A callback that will be invoked when the request succeeds.

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>
A callback that will be invoked if the request fails.
success function <optional>
A callback that will be invoked when the request succeeds.