KeyHeader
Overview
KeyHeader is a typed dictionary (with optional fields) that contains metadata about a key message in the KeySquare platform. It provides detailed information about the message's origin, type, timing, and unique identifiers.
Definition
from typing import TypedDict
class KeyHeader(TypedDict, total=False):
"""
Contains metadata about a key message.
Attributes:
sequencerId: Identifier for the sequencer
applicationId: Identifier for the application
topicSource: Source of the topic
topicGroup: Group the topic belongs to
topicId: Unique identifier for the topic
messageType: Type of the message
inceptionNanoTime: Timestamp in nanoseconds when the message was created
flags: Flags indicating properties of the key message
"""
sequencerId: int
applicationId: int
topicSource: str
topicGroup: str
topicId: str
messageType: str
inceptionNanoTime: int
sequencerNanoTime: int
relayNanoTime: int
sourceSequencerId: int
flags: KeyHeaderFlags
Attributes
sequencerId: Identifier for the sequencer (int)applicationId: Identifier for the application (int)topicSource: Source of the topic (str)topicGroup: Group the topic belongs to (str)topicId: Unique identifier for the topic (str)messageType: Type of the message (str)inceptionNanoTime: Timestamp in nanoseconds when the message was created (int)sequencerNanoTime: Sequencer timestamp in nanoseconds (int, optional)relayNanoTime: Relay timestamp in nanoseconds (int, optional)sourceSequencerId: Source sequencer identifier (int, optional)flags: Flags indicating properties of the key message (KeyHeaderFlags)
Usage Example
from keysquarepy import KeyHeader
key_header: KeyHeader = {
"sequencerId": 10,
"applicationId": 42,
"topicSource": "EXCHANGE",
"topicGroup": "EQUITIES",
"topicId": "AAPL",
"messageType": "SNAPSHOT",
"inceptionNanoTime": 1723123200000000000,
"flags": 0
}
print(key_header)
See Also
KeyMessage- Complete key message structureHeader- General message header structureKeyHeaderFlags- Key header flag settings