jetblack-fixparser
A parser for FIX messages.
Installation
The package can be installed with pip.
pip install jetblack-fixparser
Protocol Files
While FIX is a standard, the structure of the fields and messages is configurable.
This configuration is typically loaded from a file. The source repository
contains a number of such files in the /etc folder in YAML format. There is
also a QuickFix loader.
The YAML format makes use of defaults. All message fields default to type field,
so only group and component fields need to be explicitly specified. Also all
message fields are consider optional, non-optional fields must be marked as
required: true.
Usage
Decoding
To decode a FIX bytes buffer -
from jetblack_fixparser import load_yaml_protocol, FixMessage
buffer = b'8=FIX.4.4|9=94|35=3|49=A|56=AB|128=B1|34=214|50=U1|52=20100304-09:42:23.130|45=176|371=15|372=X|373=1|58=txt|10=058|',
protocol = load_yaml_protocol(
'FIX44.yaml',
is_millisecond_time=True,
is_float_decimal=True
)
fix_message = FixMessage.decode(
protocol,
buffer,
sep=b'|',
strict=True,
validate=True,
convert_sep_for_checksum=True
)
print(fix_message.message)
Note that strict validation is enabled. This ensures all required fields are
specified. Also the separator is changed from NULL to | to so they can be
displayed. However the checksum was calculated with the original field separator
so the convert_sep_for_checksum is set to true.
Encoding
To encode a dictionary describing a FIX message -
from datetime import datetime, timezone
from jetblack_fixparser import load_yaml_protocol, FixMessage
protocol = load_yaml_protocol(
'FIX44.yaml',
is_millisecond_time=True,
is_float_decimal=True,
is_type_enum=None
)
sending_time = datetime(2020, 1, 1, 12, 30, 0, tzinfo=timezone.utc)
fix_message = FixMessage(
protocol,
{
'MsgType': 'LOGON',
'MsgSeqNum': 42,
'SenderCompID': "SENDER",
'TargetCompID': "TARGET",
'SendingTime': sending_time,
'EncryptMethod': "NONE",
'HeartBtInt': 30
}
)
buffer = fix_message.encode(regenerate_integrity=True)
print(buffer)
Note that the BeginString, BodyLength and Checksum fields were automatically
generated.
Factories
To encode and decode a message using a factory -
from datetime import datetime, timezone
from jetblack_fixparser import load_yaml_protocol, FixMessage, FixMessageFactory
protocol = load_yaml_protocol(
'FIX44.yaml',
is_millisecond_time=True,
is_float_decimal=True,
is_type_enum=None
)
factory = FixMessageFactory(protocol, "SENDER", "TARGET")
sending_time = datetime(2020, 1, 1, 12, 30, 0, tzinfo=timezone.utc)
fix_messages = factory.create(
'LOGON',
42,
sending_time,
{
'EncryptMethod': "NONE",
'HeartBtInt': 30
}
)
buffer = fix_message.encode(regenerate_integrity=True)
roundtrip = FixMessage.decode(protocol, buffer)
assert fix_message.message == roundtrip.message
Because the sender and target remain the same, we can simplify message generation with the factory.
Metadata
Release files for jetblack-fixparser 2.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jetblack_fixparser-2.5.0.tar.gz | 21.2 kB | Without provenance | Details for jetblack_fixparser-2.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jetblack_fixparser-2.5.0-py3-none-any.whl | Python 3 | none | any | Details for jetblack_fixparser-2.5.0-py3-none-any.whl |
Total release size: 50.0 kB
Release files / jetblack_fixparser-2.5.0.tar.gz
| Download URL | jetblack_fixparser-2.5.0.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d35a7989556efa7c5322b08fe8055d231cfeb33dffb7f810605ee17452a1314
|
|
BLAKE2b-256 checksum How to use checksums |
7fdda212bc2ccb6f968feb726bd7a50b2b12dd673e267777d435f5986d0fa9e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.8.19
|
Release files / jetblack_fixparser-2.5.0-py3-none-any.whl
| Download URL | jetblack_fixparser-2.5.0-py3-none-any.whl |
|---|---|
| Size | 28.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d11824f8c5497d1c1ac91e46020355292c25cc2b75c4384cd1d2986d34b1f15b
|
|
BLAKE2b-256 checksum How to use checksums |
b8e74dab7139677b3ec4c87d35bec36ef4a6493f7b8b6b52c5afae298fe828f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.8.19
|
Security for jetblack-fixparser 2.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.