QuickfixJ: Getting started

I’m going to be writing a series of tutorials on using QuickfixJ to implement a simple financial application.  While I hope others can benefit from the tutorial, my primary purpose is so that I can actually get more comfortable with Java after having worked with C++ for my entire career.

QuickfixJ is a Java implementation of the popular open-source Quickfix C++ library that provides a FIX protocol engine for financial applications.  FIX is a simple text-based protocol built on TCP that consists of key-value fields separated by commas, where the keys are numerical indexes that have predefined and user-defined meanings.  There is also an XML version of the protocol, known as FIXML, though it is not utilized in industry as often due to the extra overhead of processing the larger XML messages.

Before we get started with QuickfixJ, we should set up our development environment.  The first step is to do yourself a favor and download Apache Ant.  While you could use makefiles or just build everything from the command line, Ant was made for building Java projects and if you plan to grow your application in any way, Ant will save you a lot of headaches a long the way.  From the Apache Ant project page you can download the libraries as-is and run it on your system.  Install Ant to your system path, and then run the following command to make sure that Ant is in your path and you’re ready to use it:

trantor:Development$ ant -v
Apache Ant version 1.7.1 compiled on October 13 2009
Buildfile: build.xml does not exist!
Build failed

Next, download QuickfixJ from the project website.  After you get everything uncompressed, take a look inside:

trantor:Development$ ls quickfixj/
LICENSE				quickfixj-msg-fix41-1.4.0.jar
bin				quickfixj-msg-fix42-1.4.0.jar
doc				quickfixj-msg-fix43-1.4.0.jar
etc				quickfixj-msg-fix44-1.4.0.jar
lib				quickfixj-msg-fix50-1.4.0.jar
quickfixj-all-1.4.0.jar		quickfixj-msg-fixt11-1.4.0.jar
quickfixj-core-1.4.0.jar	src
quickfixj-examples-1.4.0.jar	src.zip

QuickfixJ supports multiple versions of the FIX protocol, and you can either build with the Java library for your desired version of the protocol, or build with the quickfixj-all library that includes all versions of the protocol. Look in the lib folder too, as it contains the other required libraries.

Finally, lets set up a skeleton Ant build file that we can use to build and run our code later.  If you simply run “ant” in the working directory, it looks for a build.xml file.  We can specify a default target so that when we type “ant” on the command line, it does what we expect, just as we would with makefiles.

<project default="run">
  <path id="project.class.path">
    <!-- QuickfixJ libraries -->
    <pathelement location="/Users/globalengineer/Development/quickfixj/quickfixj-all-1.4.0.jar"/>
    <pathelement location="/Users/globalengineer/Development/quickfixj/lib/slf4j-api-1.5.3.jar"/>
    <pathelement location="/Users/globalengineer/Development/quickfixj/lib/slf4j-jdk14-1.5.3.jar"/>
    <pathelement location="/Users/globalengineer/Development/quickfixj/lib/mina-core-1.1.0.jar"/>
    <!-- Project directory-->
    <pathelement location="."/>

  <target name="compile">
    <javac srcdir=".">
      <classpath refid="project.class.path"/>

  <target name="jar depends="compile">
    <jar destfile="" basedir="." includes="**/*.class">
        <attribute name="Main-Class" value=""/>

  <target name="run" depends="jar">
    <java classname="" fork="true">
      <classpath refid="project.class.path"/>
      <arg value="config.cfg"/>

  <target name="clean">
      <fileset dir="." includes="*.class"/>
      <fileset dir="." includes="*.jar"/>

The Ant build file contains targets for compiling, creating executable jars, running jars, and cleaning up the workspace.  The classpath is specified in a single place so that we can add libraries that can be utilized by both the the compile and run targets.  Stay tuned for future tutorials on using QuickfixJ to implement a financial application.


6 thoughts on “QuickfixJ: Getting started

  1. Hi, thanks for your notes, am a complete newbie to this but have worked with fix engines a little bit and want to learn more about it – hope you keep posting!

    • Thank you for the comment!

      I’m already working on the next installment which will be ready in a few days. Please stay tuned, and feel free to post any comments or questions.

  2. Very helpful notes. I have a personal project related QuickFIX and your notes will surely help as I’m new to this. Just downloaded Ant, and waiting for your next posting! Great job, much appreciated.

  3. Hi there,

    I’ve added a build.xml file to my working directory based on your details. But Ant won’t build the file I get the following message:


    C:\Users\blakel\Desktop\quickfixj\build.xml:19: C:\Users\blakel\Desktop\quickfixj is not a file.

    I think it has something to do with these tags:
    In particular the jar destfile?

    By the way there’s a small typo in the following tag:

    It should be:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s