LSEG Data Library for TypeScript

onInsert

Attaches an event handler function to the time series stream, which will be called when data is received through it.

Syntax

stream.onInsert(callback: HistoricalPricing.TimeSeries.StreamInsertCallback)

Parameters

Value Description Data type Optional Default value
callback HistoricalPricing.TimeSeries.StreamInsertCallback function (see HistoricalPricing.StreamEvent ) function No -

Returned value

HistoricalPricing.TimeSeries.Stream object

Usage

The following example demonstrates how to display messages received when data is inserted in the stream

const stream = HistoricalPricing.TimeSeries.Definition('Events',
    {
        universe: 'VOD.L',
        fields: ['TRDPRC_1'],
        start: '2024-01-14T00:00:00.000Z',
        end: '2024-02-17T00:00:00.000Z',
    }).getStream();

await stream
    .onUpdate((update) => console.log(update.table[0].data))
    .open();

None.

56 words (0:18 mins)