Refinitiv Data Library for TypeScript

OMMStream.Event

Summary

OMMStream.Event provides a set of events that can be emitted by OMMStream

Events

OMMStream.Event.Refresh

Description: refresh events are emitted when all fields of the requested instrument are received. This complete list of fields is sometimes called the 'image' of the instrument.
This image that comes with Refresh messages can be later updated by subsequent Update events. When several Refresh events are received for the same instrument, the fields transported by the latest Refresh are considered as the new image. Fields received in previous Refresh events or Update events must be discarded.

Parameters:

  • The new fields and values of the Image
  • The OMMStream object that emitted the event

OMMStream.Event.Update

Description: Update events are emitted when fields of the requested instrument change. Update events only contain the fields and values that changed. When the application receives an Update it must update its internal representation of the instrument (if any) accordingly.

Parameters:

  • The updated fields with their new values
  • The OMMStream object that emitted the event

OMMStream.Event.Status

Description: Status events are emitted when the status of one of the requested instrument changes.

Parameters:

  • The new status of the instrument
  • The OMMStream object that emitted the event

OMMStream.Event.Complete

Description: Complete event is emitted once the requested instrument received either a Refresh or a Status event. The Complete event indicates that the Pricing.Stream object is Complete and that it's internal cache contains the full data set (instruments and fields) that were requested.

Parameters:

  • The OMMStream object that is Complete

OMMStream.Event.Error

Description: Error event is emitted when an error message is received for the requested instrument.

Parameters:

  • Error object that contains an error message
  • The OMMStream object that emitted the event

OMMStream.Event.StateChanged

Description: StateChanged event is emitted when the OMMStream state is changed.

Parameters:

  • The OMMStream object that emitted the event
  • The new state of the OMMStream. It can be: State.Opened, State.Pending, State.Closed

Side note: As Refresh events and Update events use event handlers with the same signature, the same handler can be used for these 2 event types if you do not need to distinguish them.

Events order in case of successful response for the OMMStream:
[StateChanged:Pending] -> [StateChanged:Opened] -> Refresh -> Complete -> Update -> ... -> Update -> [StateChanged: Closed]

Events order in case of error response for the OMMStream:
[StateChanged:Pending] -> Status -> Complete -> [StateChanged: Closed]

Example of usage

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