getStream
Creates and returns the pricing stream that allows you to get streaming data for previously defined instruments.
Syntax
definition.getStream(session: Session, api?: string)
Parameters
Value | Description | Data type | Optional | Default value |
---|---|---|---|---|
session | Session object. If it's not passed the default session will be used. | Session | Yes | - |
api | API path in the configuration file to build a streaming url. | string | Yes | pricing/stream |
Returned value
Pricing.Stream object
Usage
The following example demonstrates how to get the stream object to retrieve BID and ASK fields for EUR= and USD= instruments.
const definition = Pricing.Definition({
universe: ['EUR=', 'USD='],
fields: ['BID', 'ASK'],
});
const stream = await definition.getStream();
Related links
- Pricing stream open method
- Pricing stream close method
- Pricing stream getFields method
- Pricing stream getItemStatus method
- Pricing stream getUniverse method
- Pricing stream getFieldValue method
- Pricing stream onUpdate method
- Pricing stream onRefresh method
- Pricing stream onComplete method
- Pricing stream onStatus method
- Pricing stream onError method