module message
FIX message and containers module.
class MessageDirection
Direction of the message INBOUND/OUTBOUND.
class FIXContainer
Generic FIX container.
Attributes:
tags: fix tags of the container
method __init__
__init__(
tags: 'dict[str | int, [str, float, int, list[dict | FIXContainer]]]' = None
)
Initialize.
Examples: m = FIXContainer({ 1: "account", FTag.ClOrdID: 'my-clord', FTag.NoAllocs: [{312: 'grp1'}, {312: 'grp2'}], })
Args:
tags: add tags at initialization time (all keys / values converted to str!)
method add_group
add_group(tag: 'str | int', group: 'FIXContainer | dict', index: 'int' = -1)
Add repeating group item to fix message.
Args:
tag: tag of repeating group, typically containsNo, e.g. FTag.NoAllocsgroup: group item (another FIXContainer) or dict[tag: value]index: where to insert new value, default: append
Raises:
FIXMessageError: incorrect group type/value
method get
get(
tag: 'str | int | FTag',
default=<class 'asyncfix.errors.TagNotFoundError'>
) → str
Get tag value.
Args:
tag: tag to getdefault: default value or raises TagNotFoundError
Returns: string value of the tag
Raises:
FIXMessageError: trying to get FIX message group by tag, use get_group()RepeatingTagError: tag was repeated in decoded message, probably msg groupTagNotFoundError: tag was not found in message
method get_group_by_index
get_group_by_index(tag: 'str | int', index: 'int') → FIXContainer
Get repeating group item by index.
Args:
tag: repeating group tagindex: repeating group item index
Returns: FIXContainer
Raises:
TagNotFoundError: tag not found
method get_group_by_tag
get_group_by_tag(
tag: 'str | int',
gtag: 'str | int',
gvalue: 'str'
) → FIXContainer
Get repeating group item by internal group tag value.
Args:
tag: repeating group taggtag: inside group tag to filter bygvalue: expected group tag value
Returns: FIXContainer of repeating group item
Raises:
TagNotFoundError: tag not found
method get_group_list
get_group_list(tag: 'str | int') → list[FIXContainer]
Get all repeating groups of a tag.
Args:
tag: target tag
Returns: list of repeating FIXContainers
Raises:
UnmappedRepeatedGrpError: repeating group is not handled by protocol classTagNotFoundError: tag not found
method is_group
is_group(tag: 'str | int') → bool | None
Check if tag is repeating group.
Args:
tag: tag to check
Returns: None - if not found True - if repeating group False - simple tag
method items
items()
All tags items iterator.
method query
query(*tags: 'tuple[FTag | str | int]') → dict[FTag | str, str]
Request multiple tags from FIXMessage as dictionary.
Args:
*tags: tags var arguments
Returns:
dict {tag: value, ...}
method set
set(tag: 'str | int', value, replace: 'bool' = False)
Set tag value.
Args:
tag: tag to setvalue: value to set (converted to str!)replace: set True - to intentionally rewrite existing tag
Raises:
DuplicatedTagError: when trying to set existing tagFIXMessageError: tag value is not convertible to int
method set_group
set_group(tag: 'str | int', groups: 'list[dict, FIXContainer]')
Set repeating groups of the message.
Args:
tag: tag of repeating group, typically containsNo, e.g. FTag.NoAllocsgroups: group items list of (another FIXContainer) or dict[tag: value]
Raises:
DuplicatedTagError: group with the same tag already existsFIXMessageError: incorrect group type/value
class FIXMessage
Generic FIXMessage.
method __init__
__init__(
msg_type: 'str | FMsg',
tags: 'dict[str | int, [str, float, int]]' = None
)
Initialize.
Args:
msg_type: message type, must comply with FIXTag=35tags: initial tags values
property msg_type
Message type.
method add_group
add_group(tag: 'str | int', group: 'FIXContainer | dict', index: 'int' = -1)
Add repeating group item to fix message.
Args:
tag: tag of repeating group, typically containsNo, e.g. FTag.NoAllocsgroup: group item (another FIXContainer) or dict[tag: value]index: where to insert new value, default: append
Raises:
FIXMessageError: incorrect group type/value
method get
get(
tag: 'str | int | FTag',
default=<class 'asyncfix.errors.TagNotFoundError'>
) → str
Get tag value.
Args:
tag: tag to getdefault: default value or raises TagNotFoundError
Returns: string value of the tag
Raises:
FIXMessageError: trying to get FIX message group by tag, use get_group()RepeatingTagError: tag was repeated in decoded message, probably msg groupTagNotFoundError: tag was not found in message
method get_group_by_index
get_group_by_index(tag: 'str | int', index: 'int') → FIXContainer
Get repeating group item by index.
Args:
tag: repeating group tagindex: repeating group item index
Returns: FIXContainer
Raises:
TagNotFoundError: tag not found
method get_group_by_tag
get_group_by_tag(
tag: 'str | int',
gtag: 'str | int',
gvalue: 'str'
) → FIXContainer
Get repeating group item by internal group tag value.
Args:
tag: repeating group taggtag: inside group tag to filter bygvalue: expected group tag value
Returns: FIXContainer of repeating group item
Raises:
TagNotFoundError: tag not found
method get_group_list
get_group_list(tag: 'str | int') → list[FIXContainer]
Get all repeating groups of a tag.
Args:
tag: target tag
Returns: list of repeating FIXContainers
Raises:
UnmappedRepeatedGrpError: repeating group is not handled by protocol classTagNotFoundError: tag not found
method is_group
is_group(tag: 'str | int') → bool | None
Check if tag is repeating group.
Args:
tag: tag to check
Returns: None - if not found True - if repeating group False - simple tag
method items
items()
All tags items iterator.
method query
query(*tags: 'tuple[FTag | str | int]') → dict[FTag | str, str]
Request multiple tags from FIXMessage as dictionary.
Args:
*tags: tags var arguments
Returns:
dict {tag: value, ...}
method set
set(tag: 'str | int', value, replace: 'bool' = False)
Set tag value.
Args:
tag: tag to setvalue: value to set (converted to str!)replace: set True - to intentionally rewrite existing tag
Raises:
DuplicatedTagError: when trying to set existing tagFIXMessageError: tag value is not convertible to int
method set_group
set_group(tag: 'str | int', groups: 'list[dict, FIXContainer]')
Set repeating groups of the message.
Args:
tag: tag of repeating group, typically containsNo, e.g. FTag.NoAllocsgroups: group items list of (another FIXContainer) or dict[tag: value]
Raises:
DuplicatedTagError: group with the same tag already existsFIXMessageError: incorrect group type/value
This file was automatically generated via lazydocs.