FIX API Reference¶
Fix¶
Fix Session¶
- class nasdaq_protocols.fix.session.FixSessionId(host='nohost', port=0, username='nouser')¶
Bases:
SessionId- Parameters:
host (str)
port (int)
username (str)
- class nasdaq_protocols.fix.session.FixSession(on_msg_coro=None, on_close_coro=None, session_id=NOTHING, dispatch_on_connect=False, *, graceful_shutdown=True, sequence=1, client_heartbeat_interval=1, server_heartbeat_interval=1, expected_seq_num=None, on_gap=None)¶
Bases:
AsyncSession- Parameters:
on_msg_coro (Callable[[Any], Awaitable[None]])
on_close_coro (Callable[[], Coroutine])
session_id (FixSessionId)
dispatch_on_connect (bool)
graceful_shutdown (bool)
sequence (Iterator[int])
client_heartbeat_interval (int)
server_heartbeat_interval (int)
expected_seq_num (int | None)
on_gap (Callable[[int, int], Awaitable[None]] | None)
- on_msg_coro: Callable[[Any], Awaitable[None]]¶
- on_close_coro: Callable[[], Coroutine]¶
- sequence: Iterator[int]¶
- client_heartbeat_interval: int¶
- server_heartbeat_interval: int¶
- session_id: FixSessionId¶
- dispatch_on_connect: bool¶
- expected_seq_num: int | None¶
- on_gap: Callable[[int, int], Awaitable[None]] | None¶
- sender_comp_id: str¶
- sender_sub_id: str¶
- target_comp_id: str¶
- abstractmethod begin_string()¶
- send_msg(msg, *, seq_num=None, poss_dup=False)¶
Send a message to the peer. :param msg: Any message that is serializable.
- Parameters:
msg (Message)
seq_num (int | None)
poss_dup (bool)
- Return type:
None
- async send_heartbeat()¶
Callback to send a heartbeat to the peer. :meta private:
- log = <Logger FixSession (WARNING)>¶
The following keyword-only constructor parameters configure the session-layer sequence recovery (see FIX User Guide for the behaviour):
expected_seq_num(int orNone, defaultNone) – the next inboundMsgSeqNumexpected from the counterparty. WhenNone, the session bootstraps itself from theMsgSeqNumof the first inbound message (normally theLogonresponse).on_gap(coroutine(expected, received) -> NoneorNone) – optional hook invoked when an inbound gap is detected.
send_msg accepts two keyword-only parameters: seq_num (send with an explicit
MsgSeqNum without advancing the auto counter) and poss_dup (set PossDupFlag and
OrigSendingTime).
- class nasdaq_protocols.fix.session.Fix44Session(on_msg_coro=None, on_close_coro=None, session_id=NOTHING, dispatch_on_connect=False, *, graceful_shutdown=True, sequence=1, client_heartbeat_interval=1, server_heartbeat_interval=1, expected_seq_num=None, on_gap=None)¶
Bases:
FixSession- Parameters:
on_msg_coro (Callable[[Any], Awaitable[None]])
on_close_coro (Callable[[], Coroutine])
session_id (FixSessionId)
dispatch_on_connect (bool)
graceful_shutdown (bool)
sequence (Iterator[int])
client_heartbeat_interval (int)
server_heartbeat_interval (int)
expected_seq_num (int | None)
on_gap (Callable[[int, int], Awaitable[None]] | None)
- begin_string()¶
- class nasdaq_protocols.fix.session.Fix50Session(on_msg_coro=None, on_close_coro=None, session_id=NOTHING, dispatch_on_connect=False, *, graceful_shutdown=True, sequence=1, client_heartbeat_interval=1, server_heartbeat_interval=1, expected_seq_num=None, on_gap=None)¶
Bases:
FixSession- Parameters:
on_msg_coro (Callable[[Any], Awaitable[None]])
on_close_coro (Callable[[], Coroutine])
session_id (FixSessionId)
dispatch_on_connect (bool)
graceful_shutdown (bool)
sequence (Iterator[int])
client_heartbeat_interval (int)
server_heartbeat_interval (int)
expected_seq_num (int | None)
on_gap (Callable[[int, int], Awaitable[None]] | None)
- begin_string()¶
Fix Messages¶
- class nasdaq_protocols.fix.core.FixSerializable¶
Bases:
Serializable
- class nasdaq_protocols.fix.core.MessageSegments(*values)¶
Bases:
Enum
- class nasdaq_protocols.fix.core.Field(value)¶
Bases:
FixSerializable- to_bytes()¶
pack the object to binary format.
- Return type:
tuple[int, bytes]
- class nasdaq_protocols.fix.core.DataSegment(values=NOTHING)¶
Bases:
FixSerializable- Parameters:
values (dict[int, FixSerializable])
- to_bytes()¶
pack the object to binary format.
- Return type:
tuple[int, bytes]
- classmethod from_bytes(bytes_)¶
unpack the object from binary format.
- Parameters:
bytes_ (bytes)
- Return type:
tuple[int, type[DataSegment] | DataSegment]
- class nasdaq_protocols.fix.core.GroupContainer(values=None, count=0)¶
Bases:
FixSerializable- Parameters:
values (list[Group] | None)
count (int)
- to_bytes()¶
pack the object to binary format.
- Return type:
tuple[int, bytes]
- classmethod from_bytes(bytes_)¶
unpack the object from binary format.
- Parameters:
bytes_ (bytes)
- Return type:
tuple[int, type[GroupContainer] | GroupContainer]
- class nasdaq_protocols.fix.core.Group(values=NOTHING)¶
Bases:
DataSegment- Parameters:
values (dict[int, FixSerializable])
- to_bytes()¶
pack the object to binary format.
- Return type:
tuple[int, bytes]
- class nasdaq_protocols.fix.core.Message(data=None)¶
Bases:
FixSerializable- Parameters:
data (dict[MessageSegments, Any])
- to_bytes()¶
pack the object to binary format.
- Return type:
tuple[int, bytes]