Pricing.StreamEvent
Pricing.StreamEvent provides a set of events described below that can be emitted by the Pricing.Stream.
Pricing.StreamEvent.Refresh
Refresh events are emitted for each requested instrument when all fields are received.
This complete list of the 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.
Pricing.Stream objects automatically manage this logic for their internal cache, meaning that when you call getFields
you always get the latest and relevant field values for the requested instrument.
Pricing.StreamRefresh Callback Parameters
Value | Description | Data type | Optional | Default value |
---|---|---|---|---|
refresh | key:value pairs representing the new fields and values of the Image | object | - | - |
instrument | Name of the instrument | string | - | - |
stream | The Pricing.Stream object that emitted the event | Pricing.Stream | - | - |
Pricing.StreamEvent.Update
Update events are emitted for each requested instrument when fields are changed. Update events only contains the fields and values that have changed. When the application receives an Update it must update its internal representation of the instrument (if any) accordingly.
Pricing.Stream objects automatically manage this logic for their internal cache, meaning that when you call getFields
you always get the latest values of the requested instrument.
Pricing.StreamUpdate Callback Parameters
Value | Description | Data type | Optional | Default value |
---|---|---|---|---|
update | key:value pairs representing the fields and values of the Image | object | - | - |
instrument | Name of the instrument | string | - | - |
stream | The Pricing.Stream object that emitted the event | Pricing.Stream | - | - |
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.
Pricing.StreamEvent.Status
Status events are emitted when the status of one of requested instruments changes.
Pricing.StreamStatus Callback Parameters
Value | Description | Data type | Optional | Default value |
---|---|---|---|---|
status | key:value pairs representing the current status info of the stream | object | - | - |
instrument | Name of the instrument | string | - | - |
stream | The Pricing.Stream object that emitted the event | Pricing.Stream | - | - |
Pricing.StreamEvent.Complete
The Complete event is emitted once all the requested instruments received either a Refresh or a Status event.
The Complete event indicates that the all the instrument streams objects are Complete and that internal cache of all pricing instrument streams contain the full data set (instruments and fields) that were requested.
Pricing.StreamComplete Callback Parameters
Value | Description | Data type | Optional | Default value |
---|---|---|---|---|
stream | The Pricing.Stream object that is complete | Pricing.Stream | - | - |
Pricing.StreamEvent.Error
The Error event is emitted when an error message is received for one or more of the requested instruments.
Pricing.StreamError Callback Parameters
Value | Description | Data type | Optional | Default value |
---|---|---|---|---|
error | Error object received from the stream | Error | No | - |
stream | The Pricing.Stream object that emitted the event | Pricing.Stream | - | - |