Refinitiv Data Library for TypeScript

Content Layer

Introduction

The Content layer refers to logical market data objects, representing financial items like level 1 market data prices and quotes, Order Books, News, Historical Pricing, Company Research data and so on.
These objects are built on top of the Delivery layer and provide value-add capabilities to manage and access the content within the interface.

For example, the Pricing.Stream interface is a thin layer on top of the data services offering realtime market data.

In addition, interfaces such as Historical Pricing and Environmental & Social Governance (ESG) are available to allow intuitive access to request and process results.
While the native back-end data format supports JSON structured messages, the Content layer conveniently prepares data messages in a user-friendly format specific to the programming language. For example, Pandas DataFrames for Python, JSON in TypeScript/JavaScript and .NET.

Because Content layer objects are designed to simplify access to specific Web Services exposed by the Refinitiv Data Platform, these objects have a strong dependency on specific API versions of these services.

They are easy to use but also service dependant. This is not the case for the object of the Delivery layer that are lower level but also service agnostic. Please refer to the Delivery layer documentation to learn more about these objects and when to use them.

The Content layer can easily be used by both professional developers and financial coders. It provides great flexibility for familiar and commonly used financial data models.

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.

Example of usage:

@refinitiv-data/data exports Session, Delivery and Content layers functionality.
Data retrieving requires an open session that can be created with a usage of other RDP libraries.

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 retrieving data through the content objects:
import { News } from '@refinitiv-data/data';

// Session setup from the previous code block

(async () => {
    await session.open();

    const definition = News.Story.Definition('urn:newsml:reuters.com:20190926:nNRA9sv8uz:1');

    try {
        const newsStory = await definition.getData(session);
        console.log('News Story data: ', newsStory);
    } catch (err) {
        console.log(err);
    } finally {
        session.close();
    }
})();
  • For Pricing.Stream usage:
import { Pricing, PricingDefinition } from '@refinitiv-data/data';

// Session setup from the previous code block

(async () => {
    try {
        await session.open();

        const pricingDefinition: PricingDefinition = Pricing.Definition({
            universe: ['EUR=', 'UAH='],
            fields: ['DSPLY_NAME', 'BID_NET_CH'],
        });
        const pricingStream = pricingDefinition
            .getStream(session)
            .on(Pricing.StreamEvent.Refresh, (data, instrument) => console.log(data));
            .on(Pricing.StreamEvent.Update, (data, instrument) => console.log(data));
            .on(Pricing.StreamEvent.Status, (data, instrument) => console.log(data));
            .on(Pricing.StreamEvent.Complete, sp => console.log('Complete'));
            .on(Pricing.StreamEvent.Error, err => console.error(err));

        await pricingStream.open();

        console.log(pricingStream.getFields('EUR='));
        console.log(pricingStream.getFields('EUR=', ['BID_NET_CH', 'CURRENCY']));
        console.log(pricingStream.getFieldValue('EUR=', 'BID_NET_CH'));
        console.log(pricingStream.getItemStatus('EUR='));

        await pricingStream.close();
    } catch (err) {
        console.log(err);
    } finally {
        session.close();
    }
})();