T- type of the event symbol for this event type.
public interface TimeSeriesEvent<T> extends IndexedEvent<T>
TimeAndSaleevents represent the actual sales that happen on a market exchange at specific time moments, while
Candleevents represent snapshots of aggregate information about trading over a specific time period.
Time-series events can be used with
to receive a time-series history of past events. Time-series events
are conflated based on unique
index for each symbol.
Last indexed event for each symbol and index is always
delivered to event listeners on subscription, but intermediate (next-to-last) events for each
symbol+index pair are not queued anywhere, they are simply discarded as stale events.
Timestamp of an event is available via
with a millisecond precision. Some events may happen multiple times per millisecond.
In this case they have the same
time, but different
index. An ordering of
index is the same
as an ordering of
time. That is, an collection of time-series
events that is ordered by
index is ascending order will be
also ordered by
time in ascending order.
Time-series events are a more specific subtype of
All general documentation and Event Flags section, in particular,
applies to time-series events. However, the time-series events never come from multiple sources for the
same symbol and their
source is always
Unlike a general
IndexedEvent that is subscribed to via
DXFeedSubscription using a plain symbol
to receive all events for all indices, time-series events are typically subscribed to using
TimeSeriesSubscriptionSymbol class to specific time range of the subscription. There is a dedicated
DXFeedTimeSeriesSubscription class that is designed to simplify the task of subscribing for
TimeSeriesEventModel class handles all the snapshot and transaction logic and conveniently represents
a list of current time-series events ordered by their
It relies on the code of
AbstractIndexedEventModel to handle this logic.
Use the source code of
AbstractIndexedEventModel for clarification on transactions and snapshot logic.
DXPublisher.publishEventsmethod on incoming
TimeSeriesSubscriptionSymbolthe snapshot of currently known events for the requested time range has to be published first.
A snapshot is published in the descending order of
(which is the same as the descending order of
time), starting with
an event with the largest index and marking it with
IndexedEvent.SNAPSHOT_BEGIN bit in
All other event follow with default, zero
If there is no actual event at the time that was specified in subscription
fromTime property, then event with the corresponding time
has to be created anyway and published. To distinguish it from the actual event, it has to be marked
IndexedEvent.REMOVE_EVENT bit in
IndexedEvent.SNAPSHOT_END bit in this event's
is optional during publishing. It will be properly set on receiving end anyway. Note, that publishing
any event with time that is below subscription
also works as a legal indicator for the end of the snapshot.
Candle time-series events define a sequence property that is mixed
index property. It provides a way to distinguish different events at the same time.
For a snapshot end event the sequence has to be left at its default zero value. It means, that if there is
an actual event to be published at subscription
with non-zero sequence, then generation of an additional snapshot end event with the subscription
fromTime and zero sequence is still required.
|Modifier and Type||Method and Description|
Returns unique per-symbol index of this event.
Returns a source identifier for this event, which is always
Returns timestamp of the event.
getEventFlags, setEventFlags, setIndex
DEFAULTfor time-series events.
Ultimately, the scheme for event indices is specific for each even type. The actual classes for specific event types perform the corresponding encoding.
@Deprecated default long getEventId()
Copyright © 2002-2021 Devexperts LLC. All Rights Reserved.