Skip to content

Commit

Permalink
update dxfeed docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Graeme22 committed Dec 9, 2024
1 parent 6b0506b commit b7e88e2
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tastytrade/dxfeed/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,78 @@ class IndexedEvent(Event):

@property
def pending(self) -> bool:
"""
TX_PENDING is an indicator of pending transactional update.
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.
"""
return self.event_flags & TX_PENDING != 0

@property
def remove(self) -> bool:
"""
REMOVE_EVENT is used to indicate that that the event with the corresponding
index has to be removed.
"""
return self.event_flags & REMOVE_EVENT != 0

@property
def snapshot_begin(self) -> bool:
"""
SNAPSHOT_BEGIN is used to indicate when the loading of a snapshot starts.
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.
"""
return self.event_flags & SNAPSHOT_BEGIN != 0

@property
def snapshot_end(self) -> bool:
"""
SNAPSHOT_END or SNAPSHOT_SNIP are used to indicate the end of a snapshot.
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.
"""
return self.event_flags & SNAPSHOT_END != 0

@property
def snapshot_mode(self) -> bool:
"""
SNAPSHOT_MODE is used to instruct dxFeed to use snapshot mode. It is intended to
be used only for publishing to activate (if not yet activated) snapshot mode.
The difference from SNAPSHOT_BEGIN flag is that SNAPSHOT_MODE only switches on
snapshot mode without starting snapshot synchronization protocol.
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.
"""
return self.event_flags & SNAPSHOT_MODE != 0

@property
def snapshot_snip(self) -> bool:
"""
SNAPSHOT_END or SNAPSHOT_SNIP are used to indicate the end of a snapshot.
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.
"""
return self.event_flags & SNAPSHOT_SNIP != 0

0 comments on commit b7e88e2

Please sign in to comment.