Refiner Overview

Refiner is a Transformer Service blade that you can use to filter and sort large lists of records (containers). It enables you to set the filtering and sorting criteria that are relevant to you.

To find out more about how to deploy Refiner and use it to filter and sort requests, see How can I…​ Deploy the Refiner Service Module.

Example use of Refiner

For example, you could filter a container so that only the following results are returned:

  • All the bonds that mature in the forthcoming 2 year period.

  • All the bonds with a coupon greater than a particular value.

  • All the bonds with a rating greater than a particular value.

As well as filtering the results, you can also sort them into the most convenient order - in descending order of the bonds' coupon, for example. Filtering and sorting can be done in the same request. In Refiner 7.0.0 and later, you can sort on multiple fields.

Refiner Service Architecture

Refiner sits within Transformer in the Caplin Platform.

A basic Refiner setup involves a client application, which connects to Liberator using RTTP, a Transformer, which is connected to Liberator, and an Integration Adapter, which is connected to Transformer.

Transformer in Caplin Platform, showing Refiner Module

In Transformer, data transformation services are implemented in Transformer Modules. The Transformer provides an interface for Transformer Modules to register as providers for objects in a specific namespace. When client applications request an object whose subject matches the namespace for a particular Module, the Transformer requests that object from the Module, which then returns the object.

Transformer Modules can be written in Java, Lua or C. Refiner is a Java Transformer Module; it’s supplied as a Service blade that’s deployed in the Caplin Platform Deployment Framework. When Refiner receives a request for a filtered or sorted container, it requests the base container (sometimes referred to as the "underlying container") from the relevant Integration Adapter. When the base container and constituent records arrive from the Adapter, Refiner applies the filter and/or sort criteria specified by the client and sends back the results.

How container filtering works

The following diagram illustrates how container filtering works. It shows the Caplin Platform components involved in filtering the contents of a container, and the flow of subscriptions and data through the system. The actual filtering and sorting of the container is performed by the Transformer’s Caplin Refiner module, which is deployed as a Transformer Service blade.

In this example, the client application has already subscribed to the container /CTR/FI/ALL, and the instruments referred to in the container are displayed to the end-user in a grid (see the beige-coloured box at the top left of the diagram). Subsequently the end-user sets up a filter that restricts the instruments displayed in the container to those where the Coupon (CpnRate field) is greater than 6. For simplicity, the container is not windowed.

How container filtering works
  1. Caplin Trader calls the StreamLink Container Filtering API to add the filter (CpnRate>6) to the subscription for the container /CTR/FI/ALL. Liberator receives the filter as a request for the subject /FILTER/CTR/FI/ALL?(CpnRate>6).

  2. Liberator passes the container filter subscription request on to Transformer, where it is retained by Caplin Refiner, which sets up the filter. (If the base container – in this case /CTR/FI/ALL – is not in the Transformer’s cache, Transformer requests it from the relevant Integration Adapter.)

  3. At the same time, the Integration Adapter that handles the subscriptions to the instruments in the container passes back to Transformer a new container element, referring to a new instrument FI/US/C.

  4. In Transformer, Caplin Refiner applies the filter to the container according to the latest set of instruments. In this example, the value of the CpnRate field for /FI/EU/A and /FI/EU/C is less than 6, so these instruments no longer meet the filter criteria, and must be removed from the filtered container. The new instrument /FI/US/C, with its CpnRate of 10.62, matches the filter, so it is retained in the filtered container. Transformer sends a container structure change message to Liberator, specifying that the subject names /FI/EU/A and /FI/EU/C be removed from the container, and the subject name /FI/US/C be added to the container.

  5. Liberator makes the changes to the container and passes the corresponding container structure change messages on to StreamLink. StreamLink then informs the client about the change to the filtered container so that it can remove the instruments /FI/EU/A and /FI/EU/C from the filtered grid on the display, and add /FI/US/C. Any updates to the instruments /FI/EU/B, and the image for the new instrument /FI/US/C, are also fed back to the client via Liberator and StreamLink. The client updates the instruments in the filtered grid – see the grey box at the top right of the diagram.

Using Refiner

To use Caplin Refiner from a client application, the application subscribes to (requests) a subject, where the subject name indicates to the Transformer that a container is to be filtered and/or sorted. The Transformer passes the subscription request to its Caplin Refiner module, which then parses information from the subject in order to perform its functions.

The client doesn’t create such subscription requests directly, but instead calls dedicated API methods to construct filter and sort directives, which are then passed on to Caplin Refiner.

  • To use Caplin Refiner from a Caplin Trader application, call the Caplin Trader API methods on particular display components (such as grids) that allow you to filter and sort the data displayed. For details, see the Caplin Trader JavaScript Libraries API Documentation and Configure sorting and filtering (in Caplin Trader 4 grids).

  • To use Caplin Refiner from a client that isn’t a Caplin Trader application, call the API methods provided in the StreamLink library that your application uses. These methods allow you to build up the request in an object oriented way, and the request string itself is then generated by the StreamLink library. For a detailed example of how to do this, see How can I…​ Access Refiner through StreamLink.

If you want to use Caplin Refiner from another DataSource application, you create a subscription request that contains the filter and/or sort parameters and then send the request to the appropriate Transformer to be processed by its Refiner module. For example, the request could be:

/FILTER/CTR/FI/ALL?sort=Description:text:ascending

For more about this, see How Can I…​ Filter and Sort in Refiner.

Internationalisation (I18n)

I18n support is built into Refiner and includes the following:


See also: