LSEG Data Library for TypeScript

getStream

Works similarly with the method HistoricalPricing.TimeSeries.Definition.getStream().

Syntax

definition.getStream(session?: Session)

Parameters

Value Description Data type Optional Default value
session Session object. If it's not passed the default session will be used. Session Yes -

Returned value

HistoricalPricing.TimeSeries.Stream.Stream object.

Usage

The following example demonstrates how to get an events stream for the last five historical pricing data rows for GPB, specifying the start time, end time and corrections parameters:

const definition = HistoricalPricing.Events.Definition({
    universe: 'GBP=',
    count: 5,
    start: '2022-06-06T00:00:00.018000000Z',
    end: '2022-07-06T00:00:00.018000000Z',
    adjustments: ['exchangeCorrection', 'manualCorrection'],
});

await pricingDefinition
    .getStream()
    .onInsert((update) =>  console.log(update.table))
    .onRefresh((event) => console.log('on refresh: ', event))
    .onComplete(() => console.log('Complete'))
    .onError(err => console.log('Error: ', err.message))
    .open();

None.

62 words (0:20 mins)