Skip to main content
Version: Previous

FIX-Xlator

The FIX Xlator is a plugin for the Streamer and Streamer client, which enables type-safe handling of FIX messages. It also gives access to a set of vital integration features, such as FIX_IN, EXECUTION_REPORT and CUSTOM_FIX.

Enabling the FIX Xlator

To enable the plugin:

  1. Add an Xlator plugin dependency to the module pom for the Streamer or Streamer-Client.
<dependency>
<groupId>global.genesis</groupId>
<artifactId>fix-xlator</artifactId>
<version>${fix.distribution-version}</version>
</dependency>
  1. Add a dependency on the class path for the module called {applicationName}-fix-messages. This file is generated using the fix-codegen-plugin.

  2. Add the following code block at the beginning of the configuration file for the Streamer or Streamer Client:

plugins {
plugin(FixXlatorPlugin)
}

fixConfiguration {
version = fix50ref
}

The plugins tag enables the plugin, and the fixConfiguration tag specifies the version to use. The version refers to a class generated by the fix-codegen-plugin as part of step 2, and will match the version name specified in the plugin configuration in the pom.xml file.

Streamer

Enabling the plugin in a Streamer definition enables the fixStream definition.

FIX Streams: FIX Streams are enhanced stream definitions that come with a few useful defaults, enhanced fixed handling and automatic conversion to GenesisSet.

Types of fixStream

There are three separate types of fixStream configuration:

fixStream("FIX_IN")

fixStream<ExecutionReport>("EXECUTION_REPORT")

fixStream("CUSTOM", CUSTOM_FIX.FIX_INDEX, CUSTOM_FIX.DATA, ExecutionReport::class)
NameSource TableStream IndexFix ColumnStream Type
FIX_INFIX_INBY_RX_SEQUENCEFIX_DATAMessage
EXECUTION_REPORTFIX_INBY_RX_SEQUENCEFIX_DATAExecutionReport
CUSTOMCUSTOM_FIXFIX_INDEXDATAExecutionReport

When using the FIX_IN table, the appropriate index and column are selected automatically.

When specifying a message type, this will become a filter on type, so the "EXECUTION_REPORT" stream will only stream execution reports. The fields can now be accessed in a type-safe manner:

fixStream<ExecutionReport>("EXECUTION_REPORT_VODL") {
where { report ->
report.lastMkt() == "VODL"
}
}

Streamer Client

The FIX-Xlator plugin enables a number of extension functions for the Streamer Client. These are explained below.

Message extension functions

toGenesisSet

This converts a fix message to a GenesisSet. Optional parameters, list of fields:

val set = message.toGenesisSet()

set

This is an operator function that allows you to set message fields straight from a GenesisSet or a value.

executionReport.set(executionReport.yield, set)
// or
executionReport[executionReport.yield] = set
// or
executionReport[executionReport.yield] = 1.2

Please note that this function will only accept joda DateTime values for any of the quickfix date types. The value will be converted appropriately internally.

get

This function will get any field from a quick fix message:

val yield = executionReport[executionReport.yield]

The return values are always nullable. Any quick fix date type will automatically be converted to a joda DateTime value before being returned.

encodeInGenesisSet

Creates genesis set with FIX_VERSION, MESSAGE_TYPE and FIX_STRING keys, based on calling FIX message

message.encodeInGenesisSet()

createFieldWithDefault

Creates a field with default value for provided FIX message tag.

message.createFieldWithDefault(fixMessageTag)

GenesisSet extension functions

set

This function sets the field value in the GenesisSet. Optionally, you can specify the field name. Otherwise, the field name will be automatically converted

genesisSet.set(executionReport.yield)

genesisSet.set("REPORTED_YIELD", executionReport.yield)

setWithDefault

This function is similar to set, but enables you to specify a default value, default value can be constant or value of another field

// set yield with value 1.0
genesisSet.setWithDefault(executionReport.yield, 1.0)

// Set key: REPORTED_YIELD with executionReport.yield or 1.0 if executionReport.yield is null
genesisSet.setWithDefault("REPORTED_YIELD", executionReport.yield, 1.0)

// Set key: REPORTED_YIELD with executionReport.yield or executionReport.otherYield if executionReport.yield is null
genesisSet.setWithDefault("REPORTED_YIELD", executionReport.yield, executionReport.otherYield)

FIX code generation plugin

The Fix code generation plugin is used to generate Java sources from a QuickFIX XML dictionary.

Create a new maven module called {applicationName}-fix-messages. Add the following plugin dependency to the module pom file.

If you need to create multiple modules, the name of each module must be:

{applicationName}-fix-{type}-messages.

For example:

test-fix-abc-messages test-fix-xyz-messages

<plugins>
<plugin>
<groupId>org.quickfixj</groupId>
<artifactId>quickfixj-codegenerator</artifactId>
<version>${quickfix.version}</version>

<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dictFile>${project.basedir}/src/main/resources/specs/${dictionary-file}</dictFile>
<decimal>true</decimal>
<orderedFields>true</orderedFields>
<packaging>global.genesis.quickfix.${fix.protocol.version}</packaging>
<fieldPackage>global.genesis.quickfix.${fix.protocol.version}.field</fieldPackage>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>${project.parent.groupId}</groupId>
<artifactId>fix-codegen-plugin</artifactId>
<version>${fix.distribution.version}</version>

<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generateFix</goal>
</goals>
<configuration>
<dictionaryFile>${project.basedir}/src/main/resources/specs/${dictionary-file}</dictionaryFile>
<fixVersion>${fix-version}</fixVersion>
<packageName>global.genesis.quickfix.${fix.protocol.version}</packageName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

In addition, make sure to add a dependency on the fix-xlator plugin in this new module:

<dependencies>
<dependency>
<groupId>global.genesis</groupId>
<artifactId>fix-xlator</artifactId>
<version>${fix.distribution.version}</version>
</dependency>
</dependencies>