Refinitiv Data Library for TypeScript

Delivery Layer

Introduction

The Delivery layer provides objects allowing your application to interact with Refinitiv Data Platform data service via the following delivery modes:

  • Request (HTTP Request/Response)
  • Stream (WebSockets)
  • Queue (Alerts)
  • Files (bulk)

Every data service of the Refinitiv Data Platform exposes one or several of these delivery modes to make its data available to client applications. For each of these delivery modes, the Delivery layer defines classes that can be used to easily retrieve data from these data services in raw JSON format.

Classes defined in the Delivery layer do not dependent on any specific data service exposed by the Refinitiv Data Platform. They are service agnostic, meaning that you can use them to access to any service available on the platform.

Designed as the lowest abstraction layer, the Delivery layer targets developers who need specific features that are not offered by other higher level abstraction layers (Content & Function). This layer targets professional developers but can also be used by financial coders with good programming skills.

In order to use the Delivery layer for a specific service of the Refinitiv Data Platform, you need to well understand the different message formats, protocols and possible interactions available for the service. These details are described for each individual service in the Refinitiv Data Platform API Playground.

Installation

Coming soon...

Note: Installation instructions will be included in an updated version of this document that will come along with the first release of the library.

Usage

@refinitiv-data/data exports Delivery layer functionality (Endpoint, Streaming).
Data retrieving requires an open session that can be created with a usage of other RDP libraries.

  • For Platform/Desktop Session use @refinitiv-data/data package:
import { PlatformSessionParams, PlatformSession } from '@refinitiv-data/data';

const params: PlatformSessionParams = {
    appKey: 'appKey',
    userName: 'userName',
    password: 'password',
};

const session = PlatformSession.Definition(params).getSession();
  • For Container Session use @refinitiv-data/data-containersession package:
import { ContainerSessionParams, ContainerSession } from '@refinitiv-data/data-containersession';

const params: ContainerSessionParams = { appKey: 'appKey' };

const session = ContainerSession.Definition(params).getSession();
  • For API requests use EndpointRequest:
session
  .open()
  .then(() => {
    const requestParams: EndpointRequestDefinitionParams = {
        url: '/data/news/v1/analyze',
        method: EndpointRequest.Method.GET,
        query: {
            query: 'USA'
        },
    };

    const endpointRequestDefinition = EndpointRequest.Definition(requestParams);

    return endpointRequestDefinition.getData(session);
  })
  .then(data => /*handle received data*/)
  .catch(err => /*handle error*/)
  .then(() => session.close());
  • For streaming requests use stream:
session
  .open()
  .then(() => {
    const ommStream = OMMStream.Definition('EUR=').getStream(session);

    ommStream.on(OMMStream.Event.Refresh, (data) => console.log('Refresh:', data));
    ommStream.on(OMMStream.Event.Update, (data) => console.log('Update:', data));
    ommStream.on(OMMStream.Event.Status, (data) => console.log('Status:', data));
    ommStream.on(OMMStream.Event.Complete, () => console.log('Complete'));
    ommStream.on(OMMStream.Event.StateChanged, (ommStream, state) => console.log('State:', state));
    ommStream.on(OMMStream.Event.Error, err => console.log('Error:', err));

    return ommStream.open();
  })
  .then(data => ommStream.close())
  .catch(err => /*handle error*/)
  .then(() => session.close());

Other examples

You will find other examples on the Refinitiv Developer Community portal.