Skip to main content
Build status Docs Coverage Python
PyPI PyPI Downloads PyPI Monthly Downloads

Introduction

FIX (Financial Information eXchange) Protocol is a widely-used, text-based protocol for interaction between parties in financial trading. Banks, brokers, clearing firms, exchanges, and other general market participants use FIX protocol for all phases of electronic trading.

Typically, a FIX implementation exists as a FIX Engine: a standalone service that acts as a gateway for other applications (matching engines, trading algos, etc) and implements the FIX protocol. The most popular Open Source FIX engine is probably one of the versions of QuickFIX.

This package provides a simple implementation of the FIX application-layer protocol. It does no socket handling, and does not implement FIX recovery or any message persistence. It supports the creation, encoding, and decoding of FIX messages.

Licence

The module is licensed under the MIT license. While this is not legal advice, in short this means you’re free to do whatever you like with this code, with the exception of claiming you wrote it.

Installation

For most users, the easiest and best way to install simplefix is using pip:

pip install simplefix

All releases are uploaded to PyPI and available for installation, so you can pin a known, tested version in your project’s requirements.txt or project.toml (or whatever your build system uses). See the PyPI project page for the full list of available versions.

Source code releases are also available, together with some basic release notes, from the project’s GitHub Releases page.

Basic Usage

See the Programmer’s Guide for more information.

Creating Messages

To create a FIX message, first create an instance of the FixMessage class.

msg = simplefix.FixMessage()

You can then add fields to the message as required. You should add the standard header tags 8, 34, 35, 49, 52, and 56 to all messages. For most tags, using append_pair() is the easiest way to add a field to the message. When adding a UTCTimestamp value (ie, for tag 52) using append_utc_timestamp() will take care of the formatting for you.

append_string() will decompose a “tag=value” string and add it as a proper field; append_strings() will do the same for a sequence of “tag=value” strings. append_data() will correctly append a data field, setting the length tag’s value, and putting the value tag after the length in the formatted message.

Once all fields are set, calling encode() will return a byte buffer containing the correctly formatted FIX message, with fields in the required order, and automatically added and set values for the BodyLength (9) and Checksum (10) fields.

Note that if you want to manually control the ordering of all fields, the value of the BodyLength or Checksum fields, there’s a ‘raw’ flag to the encode() method that disables this functionality. This is useful for creating known-bad messages for testing purposes.

Parsing Messages

To extract FIX messages from a byte buffer, such as that received from a socket, you should first create an instance of the FixParser class. For each byte string received, append it to the internal reassembly buffer using append_buffer() . At any time, you can call get_message() : if there’s no complete message in the parser’s internal buffer, it’ll return None, otherwise, it’ll return a FixMessage instance.

Once you’ve received a FixMessage from get_message() , you can: check the number of fields with count() , retrieve the value of a field using get() or the built-in “[ ]” syntax, or iterate over all the fields using “for … in …”.

Members of repeating groups can be accessed using get(tag, nth), where the “nth” value is an integer indicating which occurrence of the tag to return (note that the first occurrence is number one, not zero).

Contributing

Comments, suggestions, bug reports, bug fixes – all contributions to this project are welcomed. See the project’s GitHub page for access to the latest source code, and please open an issue for comments, suggestions, and bugs.

See the CONTRIBUTING.rst file for more detailed instructions.

Release files for simplefix 1.0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplefix 1.0.17
File Size Uploaded
simplefix-1.0.17.tar.gz 33.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simplefix 1.0.17
File Interpreter ABI Platform
simplefix-1.0.17-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 60.3 kB

Release files / simplefix-1.0.17.tar.gz

Download URL simplefix-1.0.17.tar.gz
Size 33.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d7f86666f508b11a8839d26ad66d63eaa5e53e6d0d4e23f5ef065feead60e658
BLAKE2b-256 checksum
How to use checksums
2b9ae17706ff04ca5d0f7d10fbefe957bd85c11bb9d47ffd7a3b0f125c5f4c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.3

Release files / simplefix-1.0.17-py2.py3-none-any.whl

Download URL simplefix-1.0.17-py2.py3-none-any.whl
Size 27.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
da15798755447b9719f8688ca4cc29ee20c6d94d3227f22f60e04dcf347a2c68
BLAKE2b-256 checksum
How to use checksums
20e3cabeb722e75488b53a5d509d4ee1a0ad30683ade7210e6ea593c654ed410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.3

Release history Release notifications | RSS feed

This release

1.0.17 This release

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page