Session class

class V12.FIXAntenna.Session

FIX Session. Provides an interface to establish a connection, send and receive messages. An instance of the session can be created by the FixEngine class.

finalize() None

Releases a user reference to the session object, so the engine can destroy it when ready.

Returns:

None

Return type:

None

register_application(app: Application) None

Registers an application that will listen session events.

Parameters:

app (Application) – Application instance to process the session’s events.

Returns:

None

Return type:

None

connect() None

Connects as an acceptor.

Returns:

None

Return type:

None

connect(hbi: int, host: str, port: int) None

Connects as initiator.

Parameters:
  • hbi (int) – Heart beat interval.

  • host (str) – Remote host.

  • port (int) – Remote port.

Returns:

None

Return type:

None

connect(hbi: int, host: str, port: int, backup_hbi: int, backup_host: str, backup_port: int) None

Connects as initiator.

Parameters:
  • hbi (int) – Heart beat interval.

  • host (str) – Remote host.

  • port (int) – Remote port.

  • backup_hbi (int) – Backup heart beat interval.

  • backup_host (str) – Backup remote host.

  • backup_port (int) – Backup remote port.

Returns:

None

Return type:

None

disconnect() None

Initiates synchronous disconnect.

Returns:

None

Return type:

None

disconnect_async() None

Initiates disconnect.

Returns:

None

Return type:

None

disconnect_non_gracefully() None

Closes a connection without a logout exchange.

Returns:

None

Return type:

None

reset_seq_num_local() None

Resets sequence numbers.

Returns:

None

Return type:

None

reset_seq_num_and_send_logon() None

Resets sequence numbers both local and remote (by sending in session logon message).

Returns:

None

Return type:

None

put(msg: FixMessage) None

Sends the given message to the remote FIX engine.

Parameters:

msg (FixMessage) – FIX message to send.

Returns:

None

Return type:

None

Note

The given message is modified in place to be sent to the session.

get_in_seq_num() int

Returns the next expected incoming sequence number.

Returns:

Next expected incoming sequence number.

Return type:

int

get_out_seq_num() int

Returns the next expected outgoing sequence number.

Returns:

Next expected outgoing sequence number.

Return type:

int

set_in_seq_num(seq_num: int) None

Forcedly sets the value of the incoming sequence number (the expected MsgSeqNum of the next incoming message).

Parameters:

seq_num (int) – New sequence number.

Returns:

None

Return type:

None

set_out_seq_num(seq_num: int) None

Forcedly sets the value of the outgoing sequence number (MsgSeqNum of the next outgoing message).

Parameters:

seq_num (int) – New sequence number.

Returns:

None

Return type:

None

get_in_message(seq_num: int) FixMessage

Returns an incoming message from the session storage by the given sequence number or None if not found.

Parameters:

seq_num (int) – Sequence number.

Returns:

Incoming message from the session storage by the given sequence number or None if not found.

Return type:

FixMessage

get_out_message(seq_num: int) FixMessage

Returns an outgoing message from the session storage by the given sequence number or None if not found.

Parameters:

seq_num (int) – Sequence number.

Returns:

Outgoing message from the session storage by the given sequence number or None if not found.

Return type:

FixMessage

get_state() SessionState

Returns the current session state.

Returns:

Current session state.

Return type:

SessionState

get_parser() str

Returns the parser’s name.

Returns:

Parser name.

Return type:

str

get_app_version() FIXVersion

Returns the application’s FIX version.

Returns:

Application’s FIX version.

Return type:

FIXVersion

get_ssn_version() FIXVersion

Returns the session’s FIX version.

Returns:

Session’s FIX version.

Return type:

FIXVersion

get_outgoing_queue_size() int

Returns the number of messages in the outgoing queue.

Returns:

Number of messages in the outgoing queue.

Return type:

int

Note

A big number indicates that the remote side is a slow consumer.

get_session_id() SessionId

Returns the session ID.

Returns:

Session ID.

Return type:

SessionId

get_remote_port() int

Returns the remote port of the established connection.

Returns:

Remote port of the established connection.

Return type:

int

get_remote_host_ip() str

Returns the remote IP of the established connection.

Returns:

Remote IP of the established connection.

Return type:

str

get_storage_creation_time() float

Returns seconds (millisecond precision) since epoch 1970.01.01.

Returns:

Seconds (millisecond precision) since epoch 1970.01.01.

Return type:

float