dxFeed .Net API
5.13.0
dxFeed .Net API library intended to provide market data access for DX clients
|
Represents an indexed collection of up-to-date information about some condition or state of an external entity that updates in real-time. For example, IDxOrder represents an order to buy or to sell some market instrument that is currently active on a market exchange and multiple orders are active for each symbol at any given moment in time. IDxCandle represent snapshots of aggregate information about trading over a specific time period and there are multiple periods available. The IDxCandle is also an example of IDxTimeSeriesEvent that is a more specific event type. More...
Represents an indexed collection of up-to-date information about some condition or state of an external entity that updates in real-time. For example, IDxOrder represents an order to buy or to sell some market instrument that is currently active on a market exchange and multiple orders are active for each symbol at any given moment in time. IDxCandle represent snapshots of aggregate information about trading over a specific time period and there are multiple periods available. The IDxCandle is also an example of IDxTimeSeriesEvent that is a more specific event type.
Index for each event is available via IDxIndexedEvent.Index property. Indexed events retain information about multiple events per symbol based on the event index and are conflated based on the event index. 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. More recent events represent an up-to-date information about some external entity.
Event flags, transactions and snapshots.
Some indexed event sources provide a consistent view of a set of events for a given symbol. Their updates may incorporate multiple changes that have to be processed at the same time. The corresponding information is carried in IDxIndexedEvent.EventFlags property. Some indexed events, like IDxOrder, support multiple sources of information for the same symbol. The event source is available via IDxIndexedEvent.Source property. The value of IDxIndexedEvent.Source property is always IndexedEventSource.DEFAULT for time-series events and other singe-sourced events like IDxSeries, that do not support this feature.
The value of IDxIndexedEvent.EventFlags property has several significant bits that are packed into an integer in the following way:
31 ... 4 3 2 1 0
+-------------—+-—+-—+-—+-—+-—+
| | SS | SE | SB | RE | TX |
+-------------—+-—+-—+-—+-—+-—+
Each source updates its transactional state using these bits separately. The state of each source has to be tracked separately in a map for each source. However, event IDxIndexedEvent.Index is unique across the sources. This is achieved by allocating an event-specific number of most significant bits of IDxIndexedEvent.Index for use as a IDxIndexedEvent.Source IndexedEventSource.Id.
TX
(bit 0) - EventFlag.TxPending is an indicator of pending transactional update. It can be retrieved from eventFlags
with the following piece of code:
bool txPending = (IDxIndexedEvent.EventFlags & EventFlag.TxPending) != 0;
When txPending
is true
it means, that an ongoing transaction update that spans multiple events is in process. All events with txPending
true
shall be put into a separate pending list for each source id and should be processed later when an event for this source id with txPending
false
comes.
RE
(bit 1) - EventFlag.RemoveEvent is used to indicate that that the event with the corresponding index has to be removed.
bool removeEvent = (IDxIndexedEvent.EventFlags & EventFlag.RemoveEvent) != 0;
SB
(bit 2) - EventFlag.SnapshotBegin is used to indicate when the loading of a snapshot starts.
bool snapshotBegin = (IDxIndexedEvent.EventFlags & EventFlag.SnapshotBegin) != 0;
Snapshot load starts on new subscription and the first indexed event that arrives for each non-zero source id on new subscription may have snapshotBegin
set to true
. It means, that an ongoing snapshot consisting of multiple events is incoming. All events for this source id shall be put into a separate pending list for each source id.
SE
(bit 3) - EventFlag.SnapshotEnd or SS
(bit 4) - EventFlag.SnapshotSnip are used to indicate the end of a snapshot.
bool snapshotEnd = (IDxIndexedEvent.EventFlags & EventFlag.SnapshotEnd) != 0;
bool snapshotSnip = (IDxIndexedEvent.EventFlags & EventFlag.SnapshotSnip) != 0;
The last event of a snapshot is marked with either snapshotEnd
or snapshotSnip
. At this time, all events from a pending list for the corresponding source can be processed, unless txPending
is also set to true
. In the later case, the processing shall be further delayed due to ongoing transaction.
The difference between snapshotEnd
and snapshotSnip
is the following. snapshotEnd
indicates that the data source had sent all the data pertaining to the subscription for the corresponding indexed event, while snapshotSnip
indicates that some limit on the amount of data was reached and while there still might be more data available, it will not be provided.
When a snapshot is empty or consists of a single event, then the event can have both snapshotBegin
and snapshotEnd
or snapshotSnip
flags. In case of an empty snapshot, removeEvent
on this event is also set to true
.