Installing the Watchlist Service

The Watchlist Service provides server-hosted, persisted watchlists that can be shared between a user’s devices. To use the Watchlist Service in your client application, use Caplin Trader’s Watchlist API.

If you are upgrading to Caplin Platform 7, see Upgrading to Caplin Platform 7.

Requirements

Transformer version required:

  • Watchlist Service 7 requires Transformer 7

  • Watchlist Service 6.2 requires Transformer 6.2.3+

Upgrading to the Watchlist Service 7

Summary of important changes in the Watchlist Service 7:

  • Support for Webcentric-persisted watchlists has been discontinued.

  • The Watchlist Service 7 persists watchlists to a new database table. To preserve users' saved watchlists, you must migrate data to this new table.

For detailed upgrade instructions, see Upgrading to the Caplin Platform 7.

Deploying the Watchlist Service 7

To install Transformer’s Watchlist Service 7:

  1. Activate and configure Transformer 7’s Persistence Service. See Activating the Persistence Service 7.

  2. Copy the Watchlist Service 7 installation kit to your Deployment Framework’s kits/ directory

  3. Run the command below from the root of your Deployment Framework to deploy the Watchlist Service:

    ./dfw deploy
  4. If you have configured the Persistence Service to persist data to a relational database server, create the database tables required by the Watchlist Service.

    A reference DDL script for SQLite can be found at kits/WatchlistService/Transformer/etc/bootstrap.sql. Adapt this script to the syntax and data types of your relational database server.

    File: kits/WatchlistService/Transformer/etc/bootstrap.sql
    CREATE TABLE IF NOT EXISTS TF_WATCHLIST_PERSISTENCE (
        WATCHLIST_USER VARCHAR(250) NOT NULL,
        WATCHLIST_ID VARCHAR(250) NOT NULL,
        WATCHLIST_DATA TEXT NOT NULL, (1)
        WATCHLIST_POSITION NUMBER,
        PRIMARY KEY (WATCHLIST_USER, WATCHLIST_ID)
    );
    
    CREATE TRIGGER IF NOT EXISTS TF_WATCHLIST_PERSISTENCE_ADD_POSITION (2)
        AFTER INSERT ON TF_WATCHLIST_PERSISTENCE
    FOR EACH ROW WHEN NEW.WATCHLIST_POSITION IS NULL
    BEGIN
        UPDATE TF_WATCHLIST_PERSISTENCE
            SET WATCHLIST_POSITION = (
                SELECT COUNT(*) - 1
                FROM TF_WATCHLIST_PERSISTENCE
                WHERE WATCHLIST_USER = NEW.WATCHLIST_USER
            )
        WHERE rowid = NEW.rowid;
    END;
    1 Choose a high-capacity character type for WATCHLIST_DATA, such as TEXT or CLOB.
    2 Customise the trigger name as required (for example, the trigger name is too long for Oracle’s 32 character limit).
    Do not skip the creation of the database trigger. The trigger is essential to the correct operation of the Watchlist Service.
  5. Run the command below from the root of your Deployment Framework to restart components in your framework:

    ./dfw start

Deploying the Watchlist Service 6

To install Transformer’s Watchlist Service 6:

  1. Activate and configure Transformer 6.2’s Persistence Service. See Activating the Persistence Service 6.2.

  2. Copy the Watchlist Service 6 installation kit to your Deployment Framework’s kits/ directory

  3. Run the command below from the root of your Deployment Framework to deploy the Watchlist Service:

    ./dfw deploy
  4. Run the command below from the root of your Deployment Framework to restart components in your framework:

    ./dfw start
  5. To re-enable support for Webcentric-persisted watchlists in the Watchlist Service 6.2, edit the file <Framework-root>/global_config/overrides/WatchlistService/blade_config/watchlist.conf and set the configuration macro USE_COMPATIBLE_WATCHLIST to ENABLED.

    define USE_COMPATIBLE_WATCHLIST      ENABLED

Configure permissioning

To allow users to interact with the Watchlist Service, configure Liberator’s Permissioning Service according to the specification below. For more information about permissioning, see User Authentication and Permissioning.

Rules

Define a rule that triggers when users contribute messages to the watchlist control subject. The strings used for the 'permission namespace' and 'action' are arbitrary; you are free to customise them to your own naming scheme.

Message Subject Rule Type Permission Namespace Action Action Ref Product Ref

^/PRIVATE/WATCHLIST/%u/CONTROL

WRITE

WATCHLIST

WATCHLIST_OPERATION

-

ALL_PRODUCTS

Permissions

Assign users the following permissions.

Product set Permission Namespace Action Authorisation

.*

WATCHLIST

WATCHLIST_OPERATION

ALLOW

^/PRIVATE/WATCHLIST/%u/.*

-

VIEW

ALLOW

^/FILTER/PRIVATE/WATCHLIST/%u/.*

-

VIEW

ALLOW

Java Permissioning Integration API example

See the code below for an example of how to set the rules and permissions using the Java Permissioning Integration API.

// Rules
permissioningDataSource.createActionRule("^/PRIVATE/WATCHLIST/%u/CONTROL",
    "WATCHLIST", "WATCHLIST_OPERATION", Constants.ALL_PRODUCTS);

// WRITE permissions
java.util.HashSet<String> allProducts = new java.util.HashSet<String>();
allProducts.add(".*");
user.permit(allProducts, "WATCHLIST", "WATCHLIST_OPERATION");

// VIEW permissions
java.util.HashSet<String> viewProductSets = new java.util.HashSet<String>();
viewProductSets.add("^/PRIVATE/WATCHLIST/%u/.*");
viewProductSets.add("^/FILTER/PRIVATE/WATCHLIST/%u/.*");
user.permit(viewProductSets, Constants.DEFAULT_PERMISSION_NAMESPACE, "VIEW");

See also: