OUCH API Reference¶
Ouch¶
- class nasdaq_protocols.ouch.OuchMessageId(indicator, direction='outgoing')¶
Bases:
Serializable
- Parameters:
indicator (int)
direction (str)
- classmethod from_bytes(bytes_)¶
unpack the object from binary format.
- Parameters:
bytes_ (bytes)
- Return type:
tuple[int, OuchMessageId]
- to_bytes()¶
pack the object to binary format.
- Return type:
tuple[int, bytes]
- class nasdaq_protocols.ouch.Message(record=None)¶
Bases:
CommonMessage
- MsgIdClass¶
alias of
OuchMessageId
- async nasdaq_protocols.ouch.connect_async(remote, user, passwd, session_id, sequence=0, session_factory=None, on_msg_coro=None, on_close_coro=None, client_heartbeat_interval=10, server_heartbeat_interval=10)¶
Connect to the OUCH server.
- Parameters:
remote (tuple[str, int]) – tuple of host and port
user (str) – Username to login
passwd (str) – Password to login
session_id – Name of the session to join [Default=’’] .
sequence (int) – The sequence number. [Default=1]
session_factory (Callable[[SoupClientSession], ClientSession] | None) – Factory to create a SoupClientSession.
on_msg_coro (Callable[[Type[Message]], Awaitable[None]] | None) – callback, message from server.
on_close_coro (Callable[[], Awaitable[None]] | None) – callback, connection closed .
client_heartbeat_interval (int) – seconds between client heartbeats.
server_heartbeat_interval (int) – seconds between server heartbeats.
- Returns:
SoupClientSession
Ouch Session¶
- class nasdaq_protocols.ouch.session.OuchSessionId(soup_session_id=None)¶
Bases:
object
- Parameters:
soup_session_id (SoupSessionId)
- class nasdaq_protocols.ouch.session.ClientSession(soup_session, on_msg_coro=None, on_close_coro=None, closed=False, session_id=None, close_event=None, message_queue=None)¶
Bases:
object
- Parameters:
soup_session (SoupClientSession)
on_msg_coro (Callable[[Type[Message]], Awaitable[None]])
on_close_coro (Callable[[], Awaitable[None]])
closed (bool)
session_id (OuchSessionId)
close_event (Event)
message_queue (DispatchableMessageQueue)
- soup_session: SoupClientSession¶
- on_close_coro: Callable[[], Awaitable[None]]¶
- closed: bool¶
- async receive_message()¶
Asynchronously receive a message from the ouch session.
This method blocks until a message is received by the session.
- async close()¶
Asynchronously close the ouch session.
- decode(bytes_)¶
Decode the given bytes into an itch message.
- Parameters:
bytes_ (bytes)
- log = <Logger ClientSession (WARNING)>¶
Ouch Messages¶
- class nasdaq_protocols.ouch.core.OuchMessageId(indicator, direction='outgoing')¶
Bases:
Serializable
- Parameters:
indicator (int)
direction (str)
- classmethod from_bytes(bytes_)¶
unpack the object from binary format.
- Parameters:
bytes_ (bytes)
- Return type:
tuple[int, OuchMessageId]
- to_bytes()¶
pack the object to binary format.
- Return type:
tuple[int, bytes]
- class nasdaq_protocols.ouch.core.Message(record=None)¶
Bases:
CommonMessage
- MsgIdClass¶
alias of
OuchMessageId