ITCH API Reference

Itch

class nasdaq_protocols.itch.ItchMessageId(indicator)

Bases: Serializable

Parameters:

indicator (int)

classmethod from_bytes(bytes_)

unpack the object from binary format.

Parameters:

bytes_ (bytes)

Return type:

tuple[int, ItchMessageId]

to_bytes()

pack the object to binary format.

Return type:

tuple[int, bytes]

class nasdaq_protocols.itch.Message(record=None)

Bases: CommonMessage

MsgIdClass

alias of ItchMessageId

async nasdaq_protocols.itch.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 ITCH 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

Itch Session

class nasdaq_protocols.itch.session.ItchSessionId(soup_session_id=None)

Bases: object

Parameters:

soup_session_id (SoupSessionId)

class nasdaq_protocols.itch.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
async receive_message()

Asynchronously receive a message from the itch session.

This method blocks until a message is received by the session.

async close()

Asynchronously close the itch session.

classmethod decode(bytes_)

Decode the given bytes into an itch message.

Parameters:

bytes_ (bytes)

log = <Logger ClientSession (WARNING)>

Itch Messages

class nasdaq_protocols.itch.core.ItchMessageId(indicator)

Bases: Serializable

Parameters:

indicator (int)

classmethod from_bytes(bytes_)

unpack the object from binary format.

Parameters:

bytes_ (bytes)

Return type:

tuple[int, ItchMessageId]

to_bytes()

pack the object to binary format.

Return type:

tuple[int, bytes]

class nasdaq_protocols.itch.core.Message(record=None)

Bases: CommonMessage

MsgIdClass

alias of ItchMessageId