FixMessage class

class V12.FIXAntenna.FixMessage

Basic FIX message.

__init__(message_type : str, parser_name : str[, app_protocol : FIXVersion]) FixMessage

Creates the new skeleton of the application message and returns it.

Parameters:
  • message_type (str) – Specifies the type of the new message.

  • parser_name (str) – Version of FIX protocol to use.

  • app_protocol (FIXVersion) – Application FIX protocol version. Required if parserID is FIXT11 dialect.

Returns:

Newly created FixMessage instance.

Return type:

FixMessage

__init__(message: FixMessage) FixMessage

Duplicates the given message.

Parameters:

message (FixMessage) – message to duplicate.

Returns:

Duplicated FixMessage.

Return type:

FixMessage

to_string([tag_delimeter : int]) str

Builds str (native) representation of the message.

Parameters:

tag_delimeter (int) – symbol to use as a tag delimeter.

Returns:

String representation of the FixMessage.

Return type:

str

static from_string(str_message : str, parser_name : str[, app_protocol : FIXVersion]) FixMessage

Parses the input string and creates a corresponding structured message.

Parameters:
  • str_message (str) – Message to parse.

  • parser_name (str) – Unique FIX parser identifier of the passed message.

  • app_protocol (FIXVersion) – forces using a specified FIX version instead of using the ‘BeginString’ field (tag 8) value.

Returns:

Instance of FixMessage class.

Return type:

FixMessage

to_json([encoding_options : JsonEncoding]) str

Builds JSON representation of the message according to “Encoding FIX using JSON” standard.

Parameters:

encodingOptions (JsonEncoding) – encoding options to use

Returns:

String with JSON representation of the FixMessage.

Return type:

str

static from_json(json_msg : str, parser_name : str[, app_protocol : FIXVersion, settings : JsonParseSettings]) FixMessage

Parses JSON encoded FIX message and creates a corresponding structured message.

Parameters:
  • json_msg (str) – A string containing JSON encoded FIX message.

  • parser_name (str) – Unique FIX parser identifier of the passed message.

  • app_protocol (FIXVersion) – Forces using a specified FIX version instead of using the ‘BeginString’ field (tag 8) value.

  • settings (JsonParseSettings) – Settings to use when parsing the message.

Returns:

Instance of FixMessage class.

Return type:

FixMessage

type() str

Returns the MsgType field.

Returns:

Value of the MsgType field.

Return type:

str

get_parser() str

Returns unique parser name.

Returns:

Unique parser name.

Return type:

str

get_app_version() FIXVersion

Returns application protocol version.

Returns:

Application protocol version.

Return type:

FIXVersion

get_ssn_version() FIXVersion

Returns session protocol version.

Returns:

Session protocol version.

Return type:

FIXVersion

get_sender_comp_ID() str

Returns the value of the SenderCompID tag.

Returns:

The value of the SenderCompID tag.

Return type:

str

set_sender_comp_ID(sender_comp_id: str) None

Sets the value of the SenderCompID tag.

Parameters:

sender_comp_id (str) – Value of the SenderCompID tag to be set.

Returns:

None

Return type:

None

get_target_comp_ID() str

Returns the value of the TargetCompID tag.

Returns:

The value of the TargetCompID tag.

Return type:

str

set_target_comp_ID(target_comp_id: str) None

Sets the value of the TargetCompID tag.

Parameters:

target_comp_id (str) – Value of the TargetCompID tag to be set.

Returns:

None

Return type:

None

get_seq_num() int

Returns the MsgSeqNum field.

Returns:

The value of the MsgSeqNum field.

Return type:

int

set_seq_num(seq_num: int) bool

Updates the MsgSeqNum field.

Parameters:

seq_num (int) – New MsgSeqNum value.

Returns:

True if field value was updated, False otherwise.

Return type:

bool

get_heart_beat_interval() int

Returns Heartbeat interval (HeartBtInt) in seconds.

Returns:

Heartbeat interval (HeartBtInt) in seconds.

Return type:

int

set_heart_beat_interval(hbi: int) bool

Updates HeartBtInt field value.

Parameters:

hbi (int) – New heartbeat value.

Returns:

Always returns True.

Return type:

bool

is_original() bool

Checks the message’s originality.

Returns:

Returns True if the message is original, i.e. PossDupFlag field value is empty or equals to N. Otherwise returns False.

Return type:

bool

is_business_msg_reject_msg() bool

Checks whether the message is a Business Level Reject message.

Returns:

Returns True if the message is a Business Level Reject message. Otherwise returns False.

Return type:

bool

is_session_level_reject_msg() bool

Checks whether the message is a Session Level Reject message.

Returns:

Returns True if the message is a Session Level Reject message. Otherwise returns False.

Return type:

bool

is_administrative_msg() bool

Checks whether the message is a session level message.

Returns:

Returns True if the message is a session level message. Otherwise returns False.

Return type:

bool

set(tag: int, value: str) bool

Updates field value by tag number.

Parameters:
  • tag (int) – FIX field tag to set data to.

  • value (str) – New value for field.

Returns:

The returned value indicates previous value existence, i.e. if the previous value wasn’t empty, set() returns True, otherwise False.

Return type:

bool

remove(tag: int) bool

Empties field value by tag number.

Parameters:

tag (int) – Tag of field to remove.

Returns:

The returned value indicates previous value existence, i.e. if the previous value wasn’t empty, remove() returns True, otherwise False.

Return type:

bool

has_flag(tag: int) bool

Checks boolean field.

Parameters:

tag (int) – Tag number of the field to verify.

Returns:

True if the given flag is present and it equals “Y”, otherwise False.

Return type:

bool

is_supported(tag: int) bool

Verifies if the field is acceptable in the message.

Parameters:

tag (int) – Tag number of the field to verify.

Returns:

True if the field is supported by this message, otherwise False.

Return type:

bool

get_group(starting_tag: int) FixGroup

Returns nested repeating group.

The nested FIXGroup instance’s memory is managed by the FIX Engine. The FIXGroup instance is guaranteed to exist within its parent FIXMessage’s lifetime or until trimmed to zero length.

Parameters:

starting_tag (int) – Tag number of the leading field value.

Returns:

Returns the repeating group instance by the leading field tag number. If the leading field value is empty or its numerical representaion is zero, then the returned value is NULL.

Return type:

FixGroup

get(tag: int) str

Returns field value.

Parameters:

tag (int) – Tag of the field.

Returns:

Field value.

Return type:

str

is_empty(tag: int) bool

Checks field emptiness. Opposite to has_value().

Parameters:

tag (int) – Tag number of the field to verify.

Returns:

True if the value is empty, otherwise False.

Return type:

bool

has_value(tag: int) bool

Checks field emptiness. Opposite to is_empty().

Parameters:

tag (int) – Tag number of the field to verify.

Returns:

True if the value is set, otherwise False.

Return type:

bool