public interface MarketPrice extends Completable
MarketPrice
implementation that you can use
to open level 1 instruments published on the real-time platform (Elektron
or TREP). MarketPrice
s must be built using a MarketPrice.Builder
.
As an example, the code snippet below creates and opens the EUR/USD currency
quote (EUR=) MarketPrice
published on the ELEKTRON_DD service:
OmmConsumer ommConsumer = ...; . . . MarketPrice theMarketPrice = new MarketPrice.Builder() .withOmmConsumer(ommConsumer) .withName("EUR=") .withServiceName("ELEKTRON_DD") .build(); theMarketPrice.open();
MarketPrice
objects.
They must be set at built time via a MarketPrice.Builder
. Please refer
to this class for the exhaustive parameters list.
MarketPrice
is synchronized.
It can be used indifferently with the API_DISPATCH
and
USER_DISPATCH
OmmConsumer
operation models.Modifier and Type | Interface and Description |
---|---|
static class |
MarketPrice.Builder |
static interface |
MarketPrice.OnCompleteFunction
Represents an optional operation that is called when the
MarketPrice
is complete. |
static interface |
MarketPrice.OnImageFunction
Represents an optional operation that is called when a
MarketPrice
receives an new Refresh message (a.k.a. |
static interface |
MarketPrice.OnStateFunction
Represents an optional operation that is called when a
MarketPrice
receives a Status message that transports a new State of the MarketPrice . |
static interface |
MarketPrice.OnUpdateFunction
Represents an optional operation that is called when a
MarketPrice
receives an update message (updated fields only). |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this
MarketPrice and unsubscribes to the instrument
published by the platform. |
Field |
getField(int fieldId)
Returns the
Field identified by fieldId from
the cached image of this MarketPrice . |
Field |
getField(java.lang.String fieldName)
Returns the
Field identified by fieldName from
the cached image of this MarketPrice . |
java.util.Collection<Field> |
getFields()
Returns the collection of all
Fields that compose the image of
this MarketPrice . |
java.lang.String |
getName()
Returns the name of this
MarketPrice . |
java.lang.String |
getServiceName()
Returns the name of the service this
MarketPrice is published on. |
com.thomsonreuters.ema.access.OmmState |
getState()
Returns the
OmmState received from the platform for this
MarketPrice |
int |
getStreamId()
Returns the Id of the underlying item stream opened with the platform for the
MarketPrice |
void |
open()
Opens this
MarketPrice . |
isComplete
java.lang.String getName()
MarketPrice
. This is the name used
to identify the instrument on the real-time platform.MarketPrice
.java.lang.String getServiceName()
MarketPrice
is published on.MarketPrice
.void open()
MarketPrice
. Opening a MarketPrice
initiates the subscription to the MarketPrice
level 1 instrument
published on the platform. Once opened, the MarketPrice
starts
invoking the functional interfaces specified at built time. This method has
no effect if the MarketPrice
is already opened.void close()
MarketPrice
and unsubscribes to the instrument
published by the platform. Once closed the MarketPrice
stops
invoking the functional interfaces that have been specified when at built
time. This method has no effect if the MarketPrice
is already closed.java.util.Collection<Field> getFields()
Fields
that compose the image of
this MarketPrice
. This image (all fields) is automatically kept
updated if the MarketPrice
was open in streaming mode and if
the events of the underlying OmmConsumer
are properly dispatched.Fields
that compose the image of this
MarketPrice
. It may return an empty collection is the MarketPrice
is not opened yet or if the first Refresh message has not been received
yet from the platform.MarketPrice.Builder.withUpdates(boolean)
Field getField(java.lang.String fieldName)
Field
identified by fieldName
from
the cached image of this MarketPrice
.fieldName
- name of the Field
to return.Field
identified by fieldName
or null
if the Field
doesn't exist.Field getField(int fieldId)
Field
identified by fieldId
from
the cached image of this MarketPrice
.fieldId
- Id of the Field
to return.Field
identified by fieldId
or null
if the Field
doesn't exist.com.thomsonreuters.ema.access.OmmState getState()
OmmState
received from the platform for this
MarketPrice
OmmState
of this MarketPrice
or null
if the MarketPrice
is not opened or if the OmmState
has not been received yet from the platform.int getStreamId()
MarketPrice