/crocofix

C++ implementation of the FIX protocol

Primary LanguageC++MIT LicenseMIT

Build

CrocoFIX

CrocoFIX is a C++ implementation of the FIX protocol. CrocoFIX contains a rich data dictionary generated from the FIX Orchestra standard.

  1. Intent
  2. Requirements
  3. Orchestrations
  4. Performance
  5. Components
    1. Lexicographer
    2. libcrocofixdictionary
    3. libcrocofix
  6. Utilities
    1. fixcat
    2. fixsed
  7. Examples
    1. acceptor
    2. initiator

Intent

I use this code base as a playground for current C++ features and so have no intent to provide or maintain compatability with older language standards and I will move to newer standards as they become generally available.

Requirements

CrocoFIX currently requires a C++ 20 compiler. It is built and tested on macOS with Apple Clang from the latest Xcode and on Ubuntu with Clang 16.

The only external dependencies not included are Boost and Lua.

Check the supplied Dockerfile for detailed build requirements. This is the environment used to build in Github Actions here.

Orchestrations

I originally used the orchestrations provided by the FIX Trading Community here. These have proven to be buggy, in particular the older specifications like FIX.4.2, so I have built my own program to convert a FIX Repository to an Orchestration here.

These orchestrations are used by the lexicographer to generate content compiled into libcrocofixdictionary. The lexicographer can also be used to generate code for any other valid orchestration and this can be included in your own libraries and executables.

The lexicographer relies on fixorchestra which has been git subtree merged as follows.

git remote add -f fixorchestra https://github.com/GaryHughes/fixorchestra.git
git subtree add --prefix fixorchestra fixorchestra master --squash
# To push changes upstream
git subtree push --prefix fixorchestra fixorchestra master --squash
# To pull changes from upstream
git subtree pull --prefix fixorchestra fixorchestra master --squash

Performance

Performance

Components

lexicographer

The lexicographer is a set of Python scripts that parses the orchestration XML and generates a set of classes to allow for easy consumption of the orchestration metdata in C++ programs. Details can be found here. The generated class rely on common code in libcrocofixdictionary.

libcrocofixdictionary

This contains common code used by the classes generated by the lexicographer and is the container for the generated code.

libcrocofix

This contains general FIX functionality such as parsing and message construction. This code relies on libcrocofixdictionary.

libcrocofixlua

This contains glue code for integrating crocofix with Lua.

Utilities

fixcat

fixcat is inspired by the UNIX cat utility; it will print FIX messages in human readable format with message, field, and enumerated value descriptions. See here for details.

fixsed

fixsed is inspired by the UNIX sed utility, it sits in the middle of a TCP FIX connection and edits messages with a Lua script. See here for details.

Examples

Acceptor

This is a minimal FIX server application that will accept socket connects and will respond to any NewOrderSingles sent to it with an ExecutionReport ACK.

Initiator

This is a minimal FIX client application that will connect to a FIX server, send NewOrderSingles and wait for ExecutionReport ACK messages.

Acknowledgements

This repository includes orchestrations published by www.fixtrading.org Copyright (c) FIX Protocol Ltd. All Rights Reserved.