testplan.common.utils.sockets.fix package¶
Submodules¶
testplan.common.utils.sockets.fix.client module¶
Fix TCP client module.
-
class
testplan.common.utils.sockets.fix.client.
Client
(msgclass, codec, host, port, sender, target, version='FIX.4.2', sendersub=None, interface=None, logger=None, tls_config: Optional[testplan.common.utils.sockets.tls.TLSConfig] = None)[source]¶ Bases:
object
A Basic FIX Client Connects to a FIX server via the FIX session protocol.
-
address
¶ Returns the host and port information of socket.
-
testplan.common.utils.sockets.fix.parser module¶
FIX messages parser.
-
class
testplan.common.utils.sockets.fix.parser.
FixParser
[source]¶ Bases:
object
A barebones FIX parser
Merge in a series of tag overrides, with None signaling deletes of the original messages tags
testplan.common.utils.sockets.fix.utils module¶
Utils for FIX.
testplan.common.utils.sockets.fix.server module¶
Fix TCP server module.
-
class
testplan.common.utils.sockets.fix.server.
ConnectionDetails
(connection, name=None, queue=None, in_seqno=1, out_seqno=1)[source]¶ Bases:
object
Contains all information required for each connection to the server
-
class
testplan.common.utils.sockets.fix.server.
Server
(msgclass, codec, host='localhost', port=0, version='FIX.4.2', logger=None, tls_config: Optional[testplan.common.utils.sockets.tls.TLSConfig] = None)[source]¶ Bases:
object
A server that can send and receive FIX messages over the FIX session protocol. Supports multiple connections.
The server stamps every outgoing message with the senderCompID and targetCompID for the corresponding connection.
-
active_connections
()[source]¶ Returns a list of currently active connections
Returns: List of active connection names (each a tuple of sender and target) Return type: list
oftuple
ofstr
andstr
-
host
¶ Input host provided.
-
ip
¶ IP retrieved from socket.
-
is_connection_active
(conn_name)[source]¶ Checks whether the given connection is currently active.
Parameters: conn_name ( tuple
ofstr
andstr
) – Connection name to be checked if activeReturns: True
if the given connection is active.False
otherwiseReturn type: bool
-
port
¶ Port retrieved after binding.
-
receive
(conn_name=(None, None), timeout=30)[source]¶ Receive a FIX message from the given connection.
The connection name defaults to
(None, None)
. In this case, the server will try to find the one and only available connection. This will fail if there are more connections available or if the initial connection is no longer active.Parameters: - conn_name (
tuple
ofstr
andstr
) – Connection name to receive message from - timeout (
int
) – timeout in seconds
Returns: Fix message received
Return type: FixMessage
- conn_name (
-
send
(msg, conn_name=(None, None))[source]¶ Send the given Fix message through the given connection.
The message will be enriched with session tags and sequence numbers. The connection name - (sender, target) - defaults to (None, None). In this case, the server will try to find the one and only available connection. This will fail if there are more connections available or if the initial connection is no longer active.
Parameters: - msg (
FixMessage
) – Message to be sent. - conn_name (
tuple
ofstr
andstr
) – Connection name to send message to. This is the tuple (sender id, target id)
Returns: Fix message sent
Return type: FixMessage
- msg (
-